sudo apt-get install sendmail
如果有报错:
sendmail[6947]: NOQUEUE: SYSERR(root): /etc/mail/sendmail.cf: line 100: fileclass: cannot open '/etc/mail/local-host-names': World writable directory sm-mta[18094]: NOQUEUE: SYSERR(root): hash map "access": unsafe map file /etc/mail/access.db: World writable directory
等权限问题,尝试执行:
chmod go-w / /etc /etc/mail /usr /var /var/spool /var/spool/mqueue chown root / /etc /etc/mail /usr /var /var/spool /var/spool/mqueue
依然有 “fileclass: cannot open '/etc/mail/local-host-names'“,修改 /etc/mail/sendmail.cf 中
Fw/etc/mail/local-host-names %[^\#] 为 Fw-o/etc/mail/local-host-names %[^\#]
对于域名解析问题,报错现象为:
sendmail[18181]: My unqualified host name (ubuntu-172) unknown; sleeping for retry
同时会导致邮件服务器巨慢。
修改/etc/hosts,添加
<your-ip> <hostname> loghost <your-domain> 例如: 19.232.239.172 ubuntu-172 loghost panzhibiao.com
查看hostname使用命令'hostname'即可。