在非Gmail帐户上从php接收邮件

时间:2014-05-07 06:02:53

标签: php

我想在我的datta.dhonde@coreathena.com上收到来自php网页表单的邮件 我在datta.dhonde@gmail.com收到同样的信息,但无法在非gmail帐户上收到,如datta.dhonde@coreathena.com 以下是我的代码

<?php
  $name = $_REQUEST['name'] ;
  $email = $_REQUEST['email'] ;
  $message = $_REQUEST['msg'] ;
  $phone = $_REQUEST['phone'] ;

  //datta.dhonde@gmail.com is working but not on datta.dhonde@coreathena.com
  mail( "datta.dhonde@coreathena.com", "Contact Us Form",
    $message, "From: $email $name $phone");
  header( "Location: http://core.coreathena.com/" );
?>

1 个答案:

答案 0 :(得分:0)

你应该改变

"From: $email $name $phone"

"From: $email"

但你永远不知道$ email变量是什么。当有人把它们放在一边时,它很可能无法交付(我没有看到任何电子邮件验证)。

实际上更可靠的方法是使用专用类,例如phpmailer(查看http://phpmailer.worxware.com/)并通过SMTP发送消息。邮件功能是最简单的解决方案,但根据我的经验,您不能相信通过简单邮件功能发送的邮件将始终发送。

相关问题