2015-09-22 85 views
-1

我在我的網站使用電子郵件(),並且該功能的工作,但是從地址不顯示我的電子郵件地址,它顯示[email protected]PHP郵件()從不工作

$ito_email = "$inameuser"; 
$ifrom_email = "[email protected]"; 
$isubject = "My subject"; 
$icomment = "Hello $inameuser,\r\n\r\n" 
. " \r\n" 
. "Subject: $isubjectnote" 
. " \r\n" 
. "Notice: $inote" 
. " \r\n" 
. "\r\n" 
. "Many thanks"; 

//send email 
mail($ito_email, "$isubject", $icomment, "From: Support " . $ifrom_email); 
+0

RTM http://php.net/manual/en/function.mail.php –

+1

試試'「From:Support <」。 $ ifrom_email。 「>」' – user2959229

+0

感謝user2959229。工作。 –

回答

0

更改

mail($ito_email, "$isubject", $icomment, "From: Support " . $ifrom_email); 

mail($ito_email, "$isubject", $icomment, "From: Support <" . $ifrom_email . ">"); 

應允許您包含可讀名稱以及FROM電子郵件地址。

0

實施例:

$email = "[email protected]"; 
    $headers = 'From: ' . $email . '' . "\r\n" . "Content-type: text/html;charset = windows-1250"; 
      $subject = $email . ' - New message'; 
      mail("your email", $subject, "email message", $headers);