我的项目中必须使用邮件功能。当我在 hostgator 上托管我的项目时,它不起作用。但当我在其他服务器上托管时,它工作正常。我无法理解问题。如果有人知道答案,请解释或建议我从我可以从头开始理解的链接。谢谢。这是我的代码。
$to_address = "test@somedomain.com";
$subject = "This goes in the subject line of the email!";
$message = "This is the body of the email.\n\n";
$message .= "More body: probably a variable.\n";
$headers = "From: test@somedomain.com\r\n";
mail("$to_address", "$subject", "$message", "$headers");
最佳答案
假设您在 hostgator.in 上,并且特别提到了 hostgator,如果域不是您托管站点的域,则它不允许发送邮件。发件人或收件人的邮件应与托管的邮件相同,例如如果 ypu 有一个网站 a.com,那么发件人的邮件 ID 或收件人的邮件 ID 应该包含 @a.com
关于PHP 邮件功能在 Hostgator 上不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32859180/