- 论坛徽章:
- 0
|
[Chinese]利用msmtp和sendmail实现在linux的控制台(console)上使用smtp协议(网易免费邮箱)发邮件。
Sometimes I need build a FW image and send the image url to my colleague with image version via Email.So I would be glad be very glad to let build script do that job.
At first, I just need install a msmtp and sendmail to my hardy.
roro@anima:~$ sudo apt-get install msmtp sendmail
and setting up the msmtp with my 163 mail account.See detail below
~/.msmtprc
#Set default values for all following accounts.
defaults
#secure plain
#auth plain
#auth login
#authentication plain
tls off
port 25
#tls_trust_file /etc/ssl/certs/ca-certificates.crt
logfile ~/.msmtp.log
# A freemail service
account 163
host smtp.163.com
from robearro@163.com
auth login
user robearro@163.com
password ************
syslog on
# A second mail address at the same freemail service
#account freemail2 : freemail
#from joey@freemail.example
account default : 163 Here, I need thanks google and JoeCen's 小猫窝(its url is that:
http://www.joecen.com/2007/09/28/msmtp-cli-send-email/
), and there is the mstp manual page (
MSMTP Howto
).
Then config the mail setting.
~/.mailrc
set sendmail="/usr/bin/msmtp"
I tested, and it works.
roro@anima:~$ mail -s "test" mail@address
Later I would like to see if the msmtp support Microsoft Exchange Server.
Appendix A -- MSMTP ERROR
msmtp: cannot use a secure authentication methodIn msmtprc, the "auth" section, set it according to your mail server setting.
'auth' accepted methods are ‘plain’, ‘cram-md5’, ‘digest-md5’, ‘gssapi’, ‘external’, ‘login’, and ‘ntlm’.
Mail.163.com supports 'login'.send-mail: /home/roro/.msmtprc: must have no more than user read/write permissionsCan't send mail: sendmail process failed with error code 78roro@anima ocsis30$ ls -l /home/roro/.msmtprc
-rw-r--r-- 1 roro root 689 2009-11-25 15:00 /home/roro/.msmtprc
roro@anima ocsis30$ chmod 600 ~/.msmtprc
roro@anima ocsis30$ ls -l /home/roro/.msmtprc
-rw------- 1 roro root 689 2009-11-25 15:00 /home/roro/.msmtprc
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u3/106682/showart_2103469.html |
|