【问题标题】:PHP mail function is not working on Hostgator [duplicate]PHP邮件功能在Hostgator上不起作用[重复]
【发布时间】:2015-12-27 19:57:06
【问题描述】:

我必须在我的项目中使用邮件功能。当我在 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");

【问题讨论】:

    标签: php email server web-hosting host


    【解决方案1】:

    假设您在 hostgator.in 上并且特别提到了 hostgator,如果域不是您托管站点的域,则它不允许发送邮件。发件人或收件人的邮件应与托管相同,例如如果 ypu 有一个站点 a.com,那么发件人的邮件 ID 或收件人的邮件 ID 都应该是 @a.com

    【讨论】:

    • 谢谢。用这个解决方案解决了我的问题。
    猜你喜欢
    • 2013-12-16
    • 1970-01-01
    • 1970-01-01
    • 2014-05-19
    • 2011-04-07
    • 2012-07-12
    相关资源
    最近更新 更多