謝! 小弟的sendmail 本身是可以對外寄信, 還安裝了openwebmail 和 twig, 全部都可以對外寄信, 但用mail() 卻不行 , 是否要另外設定什麼? 例如 php.ini 或 sendmail.cf
小弟的程式碼如下:
$myname = "Me Myself";
$myemail = "myself@email.com";
$contactname = "Mister Contact";
$contactemail = "contact@email.com"; 這裏打本機的E-mail 就可寄出, 但打 @hotmail 之類的, 就不行了.
$message = "hello from happy me";
$subject = "A mail not refused by Hotmail";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: ".$myname." <".$myemail.">\r\n";
$headers .= "To: ".$contactname." <".$contactemail.">\r\n";
$headers .= "Reply-To: ".$myname." <$myreplyemail>\r\n";
$headers .= "X-Priority: 1\r\n";
$headers .= "X-MSMail-Priority: High\r\n";
$headers .= "X-Mailer: Just My Server";
mail($contactemail, $subject, $message, $headers);
當對外寄信後, 總是會收到 "Returned mail: see transcript for details" 為主旨的 E-mail