我正在使用PHP郵件()函數,並且想要更改郵件來自何處的表單,即:從默認網站電子郵件到特定電子郵件地址。我使用Dreamhost作爲我的託管服務提供商。更改與PHP郵件功能相關的電子郵件
我已經試過這樣:
<?php
$name = $_GET['name'];
$email = $_GET['email'];
$comment = $_GET['comment'];
$todayis = date("l, F j, Y, g:i a") ;
$subject = "A message sent on ".$todayis." from ".$name." via the playatics website";
$message = " Message: $comment \r \n From: $name \r \n Reply to: $email";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From: Domain Name [email protected]' . "\r\n";
mail("[email protected]", $subject, $message);
?>
這應該主要工作,除非你有一個不正確的格式的'From'頭。你應該有'域名<[email protected]>'。 – 2010-07-15 22:24:42