dpafea04148 2016-11-17 19:29
浏览 8

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

Okay guys. This is pretty weird. Basically, my mail function works, but when I delete the span element, the mail's not send anymore even tho it returns true. Why could that be?

So, this works:

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

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

$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);

And this doesn't:

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

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

$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);

As soon as I delete the span the mail is not being sent anymore...

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

PS: My spam folder is empty and, it's not a spam issue.

Thanks.

EDIT

Fixing the bottom </span>

didn't solve the issue

EDIT 2

Now I noticed that it's not the span itself, because I tried to just remove the content of the span, and it stopped working... HOW THE HELL

  • 写回答

1条回答 默认 最新

  • dongli9894 2016-11-17 19:39
    关注

    You forgot to close the </span> tag here

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

    Try this -

    $email = "mymail@gmail.com";
    $to = $email;
    $subject = "Mypage - Password recovery";
    
    $headers = 'MIME-Version: 1.0' . "
    ";
    $headers .= 'Content-type: text/html' . "
    ";
    $headers .= 'From: mypage <mypage@mypage.com>' . "
    ";
    
    $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);
    

    Hope this will help you (y).

    Got mail in spam

    enter image description here

    评论

报告相同问题?

悬赏问题

  • ¥15 微信公众平台自制会员卡可以通过收款码收款码收款进行自动积分吗
  • ¥15 随身WiFi网络灯亮但是没有网络,如何解决?
  • ¥15 gdf格式的脑电数据如何处理matlab
  • ¥20 重新写的代码替换了之后运行hbuliderx就这样了
  • ¥100 监控抖音用户作品更新可以微信公众号提醒
  • ¥15 UE5 如何可以不渲染HDRIBackdrop背景
  • ¥70 2048小游戏毕设项目
  • ¥20 mysql架构,按照姓名分表
  • ¥15 MATLAB实现区间[a,b]上的Gauss-Legendre积分
  • ¥15 delphi webbrowser组件网页下拉菜单自动选择问题