删除<span>时,mail()停止工作...?

时间:2016-11-17 19:29:11

标签: php email

好的伙计们。这很奇怪。基本上,我的邮件功能有效,但是当我删除span元素时,邮件不再发送,即使它返回true。 为什么会这样?

所以,这有效:

$email = "mymail@gmail.com";
$to = $email;
$subject = "Mypage - Password recovery";

$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html' . "\r\n";
$headers .= 'From: mypage <mypage@mypage.com>' . "\r\n";

$message = "
<html>
    <head>
    <style>
    body{
        background: #fff;
        margin: 0;
        color: #fff;
        padding: 15px;
        padding: 0;
        font-size: 100%;    
    }
    a{
        text-decoration: none;
        color: inherit;
    }
    .subutton{
        padding: 10px;
        width: 50%;
        cursor: pointer;
        transition: all linear 0.20s;
        font-size: 150%;
        border-radius: 5px;
        border: 2px solid #3387d4;
        background: #fff;
        color: #000;
    }
    </style>
    </head>

    <body>
    <h1 style='color:#111;'>Hello</h1>
    <span style='color: #000;font-size: 125%;'>Click the link below to reset your password.</span>
    <p></p>
    <div class='subutton'>Reset password</div>
    <hr />
    <br />
    <span style='color: #aaa'>Life Trigger 2016</span>
    <p style='height: 500px;'></p>
    </body>
</html>
";
mail($to,$subject,$message,$headers);

这并不是:

$email = "mymail@gmail.com";
$to = $email;
$subject = "Mypage - Password recovery";

$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html' . "\r\n";
$headers .= 'From: mypage <mypage@mypage.com>' . "\r\n";

$message = "
<html>
    <head>
    <style>
    body{
        background: #fff;
        margin: 0;
        color: #fff;
        padding: 15px;
        padding: 0;
        font-size: 100%;    
    }
    a{
        text-decoration: none;
        color: inherit;
    }
    .subutton{
        padding: 10px;
        width: 50%;
        cursor: pointer;
        transition: all linear 0.20s;
        font-size: 150%;
        border-radius: 5px;
        border: 2px solid #3387d4;
        background: #fff;
        color: #000;
    }
    </style>
    </head>

    <body>
    <h1 style='color:#111;'>Hello</h1>
    <p></p>
    <div class='subutton'>Reset password</div>
    <hr />
    <br />
    <span style='color: #aaa'>Life Trigger 2016</span>
    <p style='height: 500px;'></p>
    </body>
</html>
";
mail($to,$subject,$message,$headers);

我删除邮件后不再发送邮件......

<span style='color: #000;font-size: 125%;'>Click the link below to reset your password.</span>

PS:我的垃圾邮件文件夹是空的,它不是垃圾邮件问题。

感谢。

修改

修复底部</span>

没有解决问题

编辑2

现在我注意到它不是跨度本身,因为我试图删除跨度的内容,它停止工作......地狱怎么样

1 个答案:

答案 0 :(得分:0)

您忘了关闭此处的</span>标记

<span style='color: #aaa'>Life Trigger 2016<span>

试试这个 -

$email = "mymail@gmail.com";
$to = $email;
$subject = "Mypage - Password recovery";

$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html' . "\r\n";
$headers .= 'From: mypage <mypage@mypage.com>' . "\r\n";

$message = "
<html>
  <head>
  <style>
  body{
    background: #fff;
    margin: 0;
    color: #fff;
    padding: 15px;
    padding: 0;
    font-size: 100%;    
  }
  a{
    text-decoration: none;
    color: inherit;
  }
  .subutton{
    padding: 10px;
    width: 50%;
    cursor: pointer;
    transition: all linear 0.20s;
    font-size: 150%;
    border-radius: 5px;
    border: 2px solid #3387d4;
    background: #fff;
    color: #000;
  }
  </style>
  </head>

  <body>
  <h1 style='color:#111;'>Hello</h1>
  <p></p>
  <div class='subutton'>Reset password</div>
  <hr />
  <br />
  <span style='color: #aaa'>Life Trigger 2016</span>
  <p style='height: 500px;'></p>
  </body>
</html>
";
mail($to,$subject,$message,$headers);

希望这对你有帮助。

收到垃圾邮件

enter image description here