您的位置:首页 > 编程语言 > PHP开发

Ubuntu14.04下配置mutt和msmtp来实现邮件发送

2017-03-28 15:21 639 查看


安装:

sudo apt-get update

sudo apt-get install mutt

sudo apt-get install msmtp


配置 msmtp

安装完成之后先配置 msmtp,默认的配置文件根据每个操作系统版本不一样,通过
msmtp
--version
 来查看。
# msmtp --version
msmtp version 1.4.31
Platform: x86_64-pc-linux-gnu
TLS/SSL library: GnuTLS
Authentication library: GNU SASL
Supported authentication methods:
plain scram-sha-1 cram-md5 gssapi external digest-md5 login ntlm
IDN support: enabled
NLS: enabled, LOCALEDIR is /usr/share/locale
Keyring support: none
System configuration file name: /etc/msmtprc
User configuration file name: /root/.msmtprc

Copyright (C) 2013 Martin Lambers and others.
This is free software.  You may redistribute copies of it under the terms of
the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
There is NO WARRANTY, to the extent permitted by law.


我们这里不使用 
/etc/msmtprc
 ,

用下面的配置文件,并用当前的用户(xxx)新建该配置文件:xxx@ubuntu:~$touch .msmtprc

.msmtprc文件的内容如下:

account  default

host     smtp.163.com

user     xxx

from     xxx@163.com

password xxxxxxxxx

auth     login

tls      off

logfile   ~/.msmtp.log

注意:user必须是邮箱的前缀的字符;

      password是通过开启163邮箱的POP3/SMTP/IMAP时,自己编译的授权码;


配置 mutt

同样,我们采用全局配置。并用当前的用户(xxx)新建该配置文件:xxx@ubuntu:~$ touch .muttrc

.muttrc内容如下:

 set sendmail="/usr/bin/msmtp"
 set use_from=yes
 set realname="xxx"
 set from=xxx@163.com
 set envelope_from=yes


测试发送邮件

echo "hello world " |mutt -s "useage of hd" xxx@163.com


注:当时用过腾讯邮箱,但是需要加密的ssl,所以没有折腾出来,希望有机会再研究一下
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: