PHP mail()表单没有';无法完成发送电子邮件
但这是由我在上面分享的链接的第2步引起的,它指示我添加以下内容:PHP mail()表单没有';无法完成发送电子邮件,php,forms,email,Php,Forms,Email,但这是由我在上面分享的链接的第2步引起的,它指示我添加以下内容: unknown: warning: /etc/postfix/main.cf, line 696: overriding earlier entry: inet_protocols=all sendmail: warning: /etc/postfix/main.cf, line 676: overriding earlier entry: inet_protocols=ipv4 sendmail: warning: /etc/p
unknown: warning: /etc/postfix/main.cf, line 696: overriding earlier entry: inet_protocols=all
sendmail: warning: /etc/postfix/main.cf, line 676: overriding earlier entry: inet_protocols=ipv4
sendmail: warning: /etc/postfix/main.cf, line 696: overriding earlier entry: inet_protocols=all
postdrop: warning: /etc/postfix/main.cf, line 696: overriding earlier entry: inet_protocols=all
上面的第8行与inet_protocols=all冲突,因此我删除了上面的第8行,问题消失了,但无法发送邮件的原始问题仍然存在
myorigin = live.com
myhostname = smtp.live.com
relayhost = smtp.live.com:587
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_sasl_mechanism_filter = plain
inet_protocols = ipv4
smtp_use_tls = yes
smtp_tls_security_level=encrypt
tls_random_source=dev:/dev/urandom
我只能猜测,我的问题要么更具体到让后缀在我的MAMP Pro上工作。我没有检查mail()是否正确返回true或false,或者我可能需要使用PHPMailer或其他替代方法。查看SwiftMailer或PHPMailer可能会发现它的副本。但如果您是从本地主机发送邮件,则需要确保邮件服务器已安装并正在运行。@Qirel,那么可以使用MAMP或MAMP Pro发送邮件吗?我正试图确定我的障碍在哪里,因为我提供的主要链接看起来很可靠,但对我来说不起作用。
mail.log
是PHP\u INI\u PERDIR
,因此不会受到INI\u set
的影响。它的可能重复可能是研究SwiftMailer或PHPMailer的一个想法。但如果您是从本地主机发送邮件,则需要确保邮件服务器已安装并正在运行。@Qirel,那么可以使用MAMP或MAMP Pro发送邮件吗?我正试图确定我的障碍在哪里,因为我提供的要点链接看起来很可靠,但对我来说不起作用。mail.log
是PHP\u INI\u PERDIR
,因此不会受到INI\u set
unknown: warning: /etc/postfix/main.cf, line 696: overriding earlier entry: inet_protocols=all
sendmail: warning: /etc/postfix/main.cf, line 676: overriding earlier entry: inet_protocols=ipv4
sendmail: warning: /etc/postfix/main.cf, line 696: overriding earlier entry: inet_protocols=all
postdrop: warning: /etc/postfix/main.cf, line 696: overriding earlier entry: inet_protocols=all
myorigin = live.com
myhostname = smtp.live.com
relayhost = smtp.live.com:587
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_sasl_mechanism_filter = plain
inet_protocols = ipv4
smtp_use_tls = yes
smtp_tls_security_level=encrypt
tls_random_source=dev:/dev/urandom
// Set mail headers into a variable
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/plain; charset=iso-8859-1\r\n";
$headers .= "From: $name <$email> \r\n";
$headers .= "X-Priority: 1\r\n";
$headers .= "X-MSMail-Priority: High\r\n";
// Send the email
mail($to, $subject, $message, $headers);