0

我无法让这封电子邮件出现在 gmail 中。

代码以纯文本形式出现,所以我知道邮件服务器没有问题。但是我需要我的用户确认一个链接,但我无法让那些 html 元素出现。我已经尝试了从 mime 设置到内容类型的所有内容。

$to = $email; 
$from = "no-reply@alphaladys.com"; 
$subject = "Confirm Your Email"; 
$message = "<html><body>";
$message .= "
    <center> 
      <b>You are reiciving this email because you Signed up at Alphaladys.com</b> <br> 
      <font color=\"red\">Thank You, $name</font><br> 
      <b><a href=\"alphaladys.com/?71860c77c6745379b0d44304d66b6a13=emailVerify&key=$key\">Confirm Your Email</a></b><br>
    </center> 
    <br><br>© 2013 Copyright | AlphaLadys.Com |  All rights reserved.
"; 
$message .= "</body></html>";
$headers = "From: " . $from . "\r\n";
$headers .= "Reply-To: ". $from . "\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
mail($to, $subject , $message , $headers );
4

1 回答 1

0

我已经在我的网络主机中测试了这个例子,它运行良好:

<?php 

$from = "xxxxx@gmail.com"; 
$subject = "Confirm Your Email"; 
$message = "<html><body>";
$message .= "
    <center> 
      <b>You are reiciving this email because you Signed up at Alphaladys.com</b> <br> 
      <font color=\"red\">Thank You, $name</font><br> 
      <b><a href=\"alphaladys.com/?71860c77c6745379b0d44304d66b6a13=emailVerify&key=$key\">Confirm Your Email</a></b><br>
    </center> 
    <br><br>© 2013 Copyright | AlphaLadys.Com |  All rights reserved.
"; 
$message .= "</body></html>";
$headers = "From: " . $from . "\r\n";
$headers .= "Reply-To: ". $from . "\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
if(mail($from, $subject , $message , $headers )) echo 'Mail sent :)';
    else echo 'Mail not sent :(';}

?>

结果 : 结果

于 2013-08-27T15:49:45.773 回答