Linux下搭建mutt+msmtp发送邮件
1.自动安装
apt-get install mutt
apt-get install msmtp
vi /root/.msmtp.log //配置msmtp的日志文件
root@newbie:~# mkdir -p/usr/local/msmtp/etc
root@newbie:~# vi/root/.msmtprc //配置msmtp的配置文件
defaults
account 163mail
host smtp.163.com
port 25
tls off
auth login
from 13668157273@163.com
user 13668157273
password hzmburxvynxaakvx //这里的密码,如果163邮箱开启了客户端验证,则不能输入邮箱密码
logfile /root/.msmtp.log
account default: 163mail
root@newbie:~# chmod 600 /root/.msmtprc //修改权限
root@newbie:~# vi/root/.muttrc //配置mutt的配置文件
setsendmail="/usr/bin/msmtp"
set use_from=yes
set realname="name" //设置发件人姓名
set from=13668157273@163.com
set envelope_from=yes
root@newbie:~# msmtp -P //测试配置文件root@newbie:~# msmtp -P
ignoring system configuration file/etc/msmtprc: 没有那个文件或目录
loaded user configuration file/root/.msmtprc
falling back to default account
using account default from/root/.msmtprc
host = smtp.163.com
port = 25
timeout = off
protocol = smtp
domain = localhost
auth = LOGIN
user = 13668157273
password = *
passwordeval = (not set)
ntlmdomain = (not set)
tls = off
tls_starttls = on
tls_trust_file = (not set)
tls_crl_file = (not set)
tls_fingerprint = (not set)
tls_key_file = (not set)
tls_cert_file = (not set)
tls_certcheck = on
tls_force_sslv3 = off
tls_min_dh_prime_bits = (not set)
tls_priorities = (not set)
auto_from = off
maildomain = (not set)
from = 13668157273@163.com
dsn_notify = (not set)
dsn_return = (not set)
keepbcc = off
logfile = /root/.msmtp.log
syslog = (not set)
aliases = (not set)
reading recipients from the commandline
root@newbie:~# msmtp -S //测试smtp服务器
SMTP server at smtp.163.com(smtp.163.com [123.125.50.133]), port 25:
163.com Anti-spam GT for Coremail System (163com[20141201])
Capabilities:
PIPELINING:
Support for command grouping for fastertransmission
STARTTLS:
Support for TLS encryption via theSTARTTLS command
AUTH:
Supported authentication methods:
PLAIN LOGIN
This server might advertise more orother capabilities when TLS is active.
出现cannot locatehost smtp.126.com
解决方案:
vi /etc/hosts
123.125.50.133 smtp.163.com
如果是多个收件人,那么使用空格或者逗号分开即可,测试命令:
echo "testmail" |mutt -s "测试" XXXX@qq.comXXXX@126.com
msmtp的配置问题
如果是普通用户使用mutt+msmtp,可能会出现邮件发不出去的问题,如果上面步骤的配置文件不是设置在 ~/ 目录下的,这里可能是配置文件出了问题。
msmtp首先去读每个用户目录下的配置文件,比如root用户默认的配置文件路径为: /root/.msmtprc
cz用户默认的配置文件路径为: /home/cz/.msmtprc (注意这里有.msmtprc)
如果没有读到这个配置文件,则去读系统配置文件 /etc/msmtprc。
- Linux 下mutt和msmtp发送邮件 亲测可行
- CentOS搭建msmtp+mutt实现邮件发送
- linux mutt+msmtp工具发送邮件
- Linux_Centos使用mutt+msmtp发送邮件
- linux脚本发送邮件 shell发送邮件(使用 msmtp+mutt+shell来实现)
- Linux下安装配置msmtp和mutt发送邮件
- Linux部署msmtp+mutt发送邮件功能
- linux 下用Mutt + msmtp 发送邮件
- Linux - 安装配置msmtp和mutt发送邮件
- L05-Linux部署msmtp+mutt发送邮件
- Linux下使用mutt和msmtp命令行发送邮件
- Linux下使用mutt和msmtp命令行发送邮件
- linux下msmtp+mutt+shell发送邮件
- Linux 服务器上面 使用 mutt+msmtp 进行定时邮件发送。
- Linux下 mutt和msmtp发送邮件
- linux msmtp+mutt 自动发送邮件
- 使用mutt+msmtp做linux邮件客户端
- 利用mutt和msmtp实现邮件自动发送功能
- Zabbix利用msmtp+mutt发送邮件报警
- 烂泥:ubuntu下配置msmtp+mutt发送邮件