免费注册 查看新帖 |

Chinaunix

广告
  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1516 | 回复: 0
打印 上一主题 下一主题

msmtp + sendmail = send email on linux console (I) [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-11-25 11:24 |只看该作者 |倒序浏览

                                                                                                                                [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
  • 您需要登录后才可以回帖 登录 | 注册

    本版积分规则 发表回复

      

    北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
    未成年举报专区
    中国互联网协会会员  联系我们:huangweiwei@itpub.net
    感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

    清除 Cookies - ChinaUnix - Archiver - WAP - TOP