I just added a feature to my website which e-mails all Members who have subscribed to an Article Thread (e.g. “Postage Meters Can Save You Money”) when other Members post new Comments.
Unfortunately, my test data is not sending me an e-mail.
Here is my e-mail specific code…
// ******************************
// Create New-Comment E-mail. *
// ******************************
$title = 'Re: New comment on "' . $articleHeading . '" ' . rand(5, 1000) . "\
";
$body = "<p>Dear $subscriberFirstName,</p>\
";
$body .= "<p>The user, \\"$commenterUsername\\", has posted a new comment to the article:<br />\
\ ";
$body .= "<span class='indent'>\\"$articleHeading\\"</span>\
";
$body .= "<p>To view this article, <a href='/articles/" . $articleSlug . "'>click here</a></p>\
";
$body .= "<p>To view this comment, <a href='/articles/" . $articleSlug . "#comment_" . $commentID . "'>click here</a></p>\
";
$body .= "<p>Sincerely,<br /><br /><br />\
\
\
";
$body .= "<p>Customer Service</p>";
$headers = "From: admin@MySite.com <admin@MySite.com\\r\
";
$headers .= "MIME-Version: 1.0\\r\
";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\\r\
";
//echo $subscriberEmail . "<br /><br />";
//echo $title;
//echo $body;
//echo $headers;
//exit();
mail($subscriberEmail, $title, $body, $headers);
When I uncomment the echoes above, I am getting expected values in each variable, so I would expect my e-mail to work?! :-/
I also added a random # to the Subject Line as it makes Gmail less inclined to think this is spam.
**NOTE: I am trying to run this script from my laptop, so I don’t have a valid Email/Domain/IP in my Dev Environment, but I haven’t really had any issues on a separate script which e-mails me every time there is a System Error, so I would expect this to work as well…
I also tried changing where the test “New Comment” e-mail goes, routing it to my ATT e-mail, thinking it is less picky than Gmail??
Is my code wrong, or am I getting treated as SPAM??
Thanks,
Debbie