msmtp+mutt运行时报child exited 127 (Exec error.)错误的解决方法

在运行mutt命令时报下列错误

[root@zabbix~]# echo "www.clvn.com.cn" | mutt -s "My Web" [email protected]
Error sending message, child exited 127 (Exec error.).
Could not send the message.

解决方法:

先使用msmtp进行发送测试

[root@zabbix ~]# /usr/local/msmtp/bin/msmtp -S
SMTP server at smtp.sohu.com ([220.181.90.34]), port 25:
    zw_71_37 ESMTP ready
Capabilities:
    STARTTLS:
        Support for TLS encryption via the STARTTLS command
    AUTH:
        Supported authentication methods:
        PLAIN LOGIN
This server might advertise more or other capabilities when TLS is active.

发现没有什么问题。

 

再利用msmtp查看当前文件路径

[root@zabbix ~]# /usr/local/msmtp/bin/msmtp -P
loaded system configuration file /usr/local/msmtp/etc/msmtprc
ignoring user configuration file /root/.msmtprc: No such file or directory
falling back to default account
using account default from /usr/local/msmtp/etc/msmtprc
host                  = smtp.sohu.com
port                  = 25
timeout               = off
protocol              = smtp
domain                = localhost
auth                  = LOGIN
user                  = zabbix2018
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                  = [email protected]
dsn_notify            = (not set)
dsn_return            = (not set)
keepbcc               = off
logfile               = /var/log/zabbix/msmtp.log
syslog                = (not set)
aliases               = (not set)
reading recipients from the command line

 从上面显示配置文件也没有什么问题,但是查看Muttrc.loca时

[root@zabbix ~]# cat /etc/Muttrc.local

# Local configuration for Mutt.
set sendmail='/usr/local/msmtp/bin/msmtp"
set use_from=yes
set realname="[email protected]"
set editor="vim"

可以看到双引号写成单引号了,更改此配置文件

[root@zabbix ~]# vim /etc/Muttrc.local

# Local configuration for Mutt.
set sendmail="/usr/local/msmtp/bin/msmtp"
set use_from=yes
set realname="[email protected]"
set editor="vim"

再次进行发送测试

[root@zabbix ~]# echo "test" | mutt -s "test" [email protected]

登录邮箱进行查看,可以看到收到邮件

wKiom1OBLiaQQWe1AAGxdkEpvWE657.jpg

你可能感兴趣的:(msmtp)