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

本文介绍如何在Ubuntu上使用Mutt和msmtp配置邮件客户端,包括安装过程、配置文件设置及发送测试邮件的方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

安装:

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,所以没有折腾出来,希望有机会再研究一下

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值