正在发送我的html电子邮件


Sending my html email

我知道关于这个主题到处都有很多信息,但我似乎在兜圈子,非常感谢任何帮助。我正在尝试发送一个简单的html电子邮件与一些内联css。电子邮件似乎没有到达。。。

<?php
// Email the user their activation link
        $to = "name@website.com";                            
        $from = "me@website.com";
        $subject = 'Test HTML Email';
$headers = "";
$headers .= "MIME-Version: 1.0'r'n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1'r'n";
$message = '<div style="padding:10px; background:#000; font-size:46px; font-weight: 900; color:#fff; ">
        My Website
      </div>
      <div style="padding:24px; font-size:17px; background:#DCDCDC  ; ">
        This is a message sent from my website
        <br>
        <br>
        <a href="http://www.mywebsite.com">Login in to your account</a>
        <br>
        <br>
      </div>';
mail($to, $subject,  $message, $headers);
?>

重写此代码:

$headers = "";
$headers .= "MIME-Version: 1.0'r'n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1'r'n";

到此:

$headers = "";
$headers .= "MIME-Version: 1.0'r'n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1'r'n";
$headers .= "To: ". $to. "'r'n";
$headers .= "From: ". $from;

尝试添加以下内容:

$headers .= "From: $from" . "'r'n" .
            "Reply-To: $from" . "'r'n" .
            'X-Mailer: PHP/' . phpversion();