![不同 Linux 服务器中的邮件发送格式问题](https://linux22.com/image/657222/%E4%B8%8D%E5%90%8C%20Linux%20%E6%9C%8D%E5%8A%A1%E5%99%A8%E4%B8%AD%E7%9A%84%E9%82%AE%E4%BB%B6%E5%8F%91%E9%80%81%E6%A0%BC%E5%BC%8F%E9%97%AE%E9%A2%98.png)
我创建了一个发送邮件脚本,它将在我的几台客户端服务器上运行。邮件在几台服务器上发送正确,但在某些服务器上,我们收到的格式不是我们预期的。错误的服务器可能存在什么问题?如何纠正它,以便它在所有服务器上正常工作?
邮件脚本
msg=$toaddr
toaddr=$rtnaddr
rtnaddr=$ccaddr
echo "$msg" | mail -s "$subj" -c $ccaddr "$toaddr" -- -f "$rtnaddr"
在此服务器上运行良好
send_notification "Test" "this is test1" [email protected] noreply@returnaddress [email protected]
email toaddress and cc with return address
[xxxx1]$ uname -a
Linux xxxx1 2.6.39-300.26.1.el5uek #1 SMP Thu Jan 3 18:31:38 PST 2013 x86_64 x86_64 x86_64 GNU/Linux
[xxxx1]$ rpm -qa |grep -i mail
sendmail-8.13.8-8.1.el5_7
procmail-3.22-17.1.0.1
mailcap-2.1.23-1.fc6
mailx-8.1.1-44.2.2
fetchmail-6.3.6-4.el5
正确收到电子邮件
FROM: noreply@returnaddress
TO: [email protected]
CC: [email protected]
在不同的服务器上发送电子邮件并接收格式错误的邮件
[xxxx2]# send_notification "Test" "this is test1" [email protected] noreply@returnaddress [email protected]
email toaddress and cc with return address
[xxxx2]# uname -a
Linux xxxx2 3.8.13-16.2.1.el6uek.x86_64 #1 SMP Thu Nov 7 17:01:44 PST 2013 x86_64 x86_64 x86_64 GNU/Linux
[xxxx2]# rpm -qa |grep -i send
nautilus-sendto-2.28.2-4.el6.x86_64
[xxxx2]# rpm -qa |grep -i mail
procmail-3.22-25.1.el6.x86_64
mailx-12.4-7.el6.x86_64
perl-Mail-DKIM-0.37-2.el6.noarch
perl-MailTools-2.04-4.el6.noarch
mailcap-2.1.31-2.el6.noarch
libreport-plugin-mailx-2.0.9-19.0.1.el6.x86_64
收到邮件如下
FROM: osuser@`hostname`
TO : noreply@returnaddress, -f@`hostname`, --@`hostname`, [email protected]
CC: [email protected]