【发布时间】:2020-12-27 11:26:59
【问题描述】:
我正在使用以下代码从我的网站发送电子邮件:
<?php
$to = "mygmail@gmail.com;
$subject = "My Site - NoReply";
$headers = "From: do not reply @ My Site" . "\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$message = "You have received a message from the My site: <br /><br />";
$message .= "Greetings <strong>My Name</strong>, <br /><br />";
$message .= "You have been granted access to the My site.<br /><br />";
mail($to, $subject, $message, $headers);
?>
我的网站由 Hostgator 托管。他们建议我应该为 SMTP 使用端口 465。
我刚和他们聊完。万事俱备,他们无能为力。
话虽如此,为什么我无法使用上述方式发送电子邮件?
我在我的工作中使用了相同的代码,它使用 Apache 服务器,并且我从网站发送任何电子邮件都没有问题。
我缺少什么来完成这项工作?
【问题讨论】:
-
这个问题可能包含一些见解stackoverflow.com/questions/18535294/…