邮件不是从命令行和PHP函数发送的

时间:2016-01-05 03:16:26

标签: php shell email

我安装了" mailutils"在两个服务器中打包,在第一个服务器中使用命令行发送邮件,第二个服务器不发送邮件:

第一台服务器的dpkg --get-selections:

# dpkg --get-selections | grep mail
heirloom-mailx                                  install
libmail-sendmail-perl                           install
libmailtools-perl                               install
libmailutils2                                   install
libreoffice-emailmerge                          install
mailutils                                       install
procmail                                        install
sendmail-base                                   install
sendmail-bin                                    install
sendmail-cf                                     install

dpkg - 第二台服务器的选择:

# dpkg --get-selections | grep mail
libmailutils2                                   install
libreoffice-emailmerge                          install
mailutils                                       install

命令行是:

echo -e "File mp4 is finished on Thank you for using this script" 2>&1 | sed '1!b;s/^/To: MYID@gmail.com\nSubject: File coding is done\n\n/' | sendmail -t

这是php函数:

<?php

error_reporting(E_ALL);

$send = mail('MYID@gmail.com', 'sujet', 'salut');

if($send) {
echo 'mail sent';
}
else
{
echo 'oho';
}

?>

提前致谢

1 个答案:

答案 0 :(得分:0)

如果直接拨打sendmail,您的服务器是否可以发送电子邮件?

echo -e "File mp4 is finished on Thank you for using this script" 2>&1 | sed '1!b;s/^/To: MYID@gmail.com\nSubject: File coding is done\n\n/' | sendmail -t