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' . "\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);
And this doesn't:
$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);
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
` and `
` but not `` so that could be the reason. Btw, you shouldn't rely on `` in head since most email clients will ignore/reject it. Always use inline CSS.
– Funk Forty Niner Nov 17 '16 at 19:36