Aks*_*iya 2 php email web-hosting host server
我必须在我的项目中使用邮件功能.当我在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");
Run Code Online (Sandbox Code Playgroud)
小智 9
假设您在hostgator.in上,特别是您提到的hostgator,如果域名不是您托管您网站的域名,则不允许邮件发送.发件人或收件人的邮件应该与托管邮件相同,例如,如果ypu有一个站点a.com,那么发件人的邮件ID或收件人的邮件ID应该有@a.com