PHP mail() not sending emails on level

Status
Not open for further replies.

zinteenx

New Member
Messages
25
Reaction score
0
Points
1
I am using php mail to notify my subscribers of new blog posts.
Because my below function wasn't sending I decided to add an error catcher, and mail() returns true, and it shows my email address, however the email is not sent. Please help

PHP:
$sql = "SELECT * FROM subscribers";
    while ($ste = mysqli_fetch_array(mysqli_query($con,$sql)))
    {
    $messager="
<html>
<head>
<title>Check out what's happening on my Blog this week</title>
<body>
";   
$date = date("Y-m-d H:i:s",mktime(date("H"),date("i"),date("s"),date("m"),date("d")-7));
    $sqli = "SELECT * FROM blog WHERE date > '$date' LIMIT 2";
    $res = mysqli_query($con,$sqli);
    while ($jw = mysqli_fetch_array($res))
    {
    $messager = $messager."<h2>$jw[header] by $jw[author]</h2><p>".substr($jw["text"], 0, 250)."..."."</p><br>";
    }
    $messager = $messager."</body></html>";
    // To send HTML mail, the Content-type header must be set
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From: <[EMAIL]no-reply@zinteen.co.uk[/EMAIL]>';
$headers .= "X-Mailer: PHP/" . phpversion(); 
   $ma= mail("$ste", "Check out what's happening on my Blog this week",
    $messager, $headers);
    if ($ma)
    die("should've worked.".$ste["email"]);
    }
}

Edit by Dead-i: Wrapping the code with code tags.
 
Last edited by a moderator:

Livewire

Abuse Compliance Officer
Staff member
Messages
18,169
Reaction score
216
Points
63
Your emails are being picked up as spam by the outgoing email server, and are being discarded. I'm not personally sure how to read the spam codes to get more information as to what's causing them to be marked as spam, but it's definitely showing that it was discarded and never sent. I would suggest reformatting the email to try and get past this, along with adding an unsubscribe link to the emails (this may not help with it being marked as spam, but the email's current form does NOT abide by the CAN-SPAM act of 2003, so it's worth adding anyways).
 
Status
Not open for further replies.
Top