Forum Moderators: coopster
I am trying to send HTML emails from a php script I am developing, using the mail() function in PHP. To get the HTML code working across multiple clients I have been trying it, but have noticed that Thunderbird is classing it as a "scam" (despite telling it 100s of times its not) and Hotmail (testing it on my sisters) insists it is junk mail.
The emails I am trying to send are "verify your email address" emails, and when I get further in the script, other similarly important emails.
I have managed to narrow it down to being something up with the headers. If I send a plain text email, I get no problems. If I manually (Thunderbird) send an html email from the address my script is sending from, I have no problems.
Here are the headers I am using:
$eml_headers = "From: art.example.net<noreply@example.net>\r\n".
"Reply-To: support@example.net\r\n".
"Return-Path: noreply@example.net\r\n".
"MIME-Version: 1.0\r\n" .
"Content-type: text/html; charset=iso-8859-1\r\n";
I can post the rest of the code up, but I'm not sure that it is relevant. I have spent all of yesterday morning, and this morning searching google and various forums, to no avail.
All help is greatly appreciated.
Thanks. :)
[edited by: jatar_k at 3:43 pm (utc) on May 11, 2006]
[edit reason] examplified [/edit]
there are a ton around
the things to look at are
email headers
content of email
mail server config
They either seem to talk of the problem - then don't give a straight answer, or it is about contact forms being abused, or blocking spam emails via the mail function.
I'm guessing I am missing a header, or am using the wrong one, but I can't find what I'm missing anywhere. :(
EDIT: Might have got somewhere. I read that if the domain that sent it is different than the one it is specified in the email headers then you get a problem? I'm on shared hosting, so this is happening.
However, how come it is only happening on HTML based emails?
so...
it is either your content or your mail server
those are the next things to look at
you're getting sent to spam, you may always but you can reduce the possibility by tailoring your content and making sure your mail server is properly conf'ed
$eml_message = "<html><head><title>Thanks for joining art.example.net</title></head>".
"<body><div style=\" margin-right: 5px;margin-bottom: 15px;margin-left: 5px;margin-top: 20px;background-color: #ffffff;text-align: right;font-family: Trebuchet MS;font-size: 24px;font-weight: bold;color: #6a7174;border-bottom: 1px solid #bec8ce;margin-right: 5px;margin-bottom: 15px;margin-left: 5px;margin-top: 20px;\">".
"<a href=\"http://art.example.net\" style=\"color:#6a7174;\"><font color=\"#ef6215\">art.</font>example.net</a></div>".
"<span style=\"font-family: Arial;font-size: 18px;font-weight: bold;color: #7e8d95;\">Welcome!</span><br/><br/>".
"<span style=\"font-size:12px;font-family: Arial;color:#6a7174;\">Hello and thanks for joining <a href=\"http://art.example.net\" style=\"color:#6a7174;font-size:12px;\">art.example.net</a>! By joining <a href=\"http://art.example.net\" style=\"color:#6a7174;font-size:12px;\">art.example.net</a>, you also gain access to all other <a href=\"http://www.example.net\" style=\"color:#6a7174;font-size:12px;\">example.net</a> sites!".
" For more information about <a href=\"http://art.example.net\" style=\"color:#6a7174;font-size:12px;\">art.example.net</a> and other <a href=\"http://www.example.net\" style=\"color:#6a7174;font-size:12px;\">example.net</a> websites, please see our <a href=\"#\" target=\"_blank\" style=\"color:#ef6215;font-size:12px;\">Getting Started Guide</a>.</span><br/><br/>".
"<span style=\"font-size:12px;font-family: Arial;color:#6a7174;\">Before you will be able to login to a <a href=\"http://www.example.net\" style=\"color:#6a7174;font-size:12px;\">example.net</a> website, you will need to verify your email address. You can do this by clicking the link below, or going to <a href=\"http://beta.example.net/index.php/verify\" style=\"color:#6a7174;font-size:12px;\">http://beta.example.net/index.php/verify</a> and entering the verification code also shown below.</span><br/><br/>".
"<div style=\"font-size:12px;font-family: Arial;color: #4c5d66;background-color: #f2f6f7;padding: 3px;margin: 3px;font-weight: bold;\"><a href=\"http://beta.example.net/index.php/verify/123456\" style=\"color:#ef6215;font-size:12px;\">Please click here to verify your email address.</a><br/><br/><i>-- OR --</i><br/><br/>".
"Go to <a href=\"http://art.example.net/index.php/verify\" style=\"color:#ef6215;font-size:12px;\">http://beta.example.net/index.php/verify</a> and enter the following verification code: 123456</div><br/>".
"<span style=\"font-size:12px;font-family: Arial;color:#6a7174;\"><b><i>Thanks for joining <a href=\"http://www.example.net\" style=\"color:#ef6215;font-size:12px;\">example.net</a>!</i></b></span><br/><br/>".
"<hr/><span style=\"font-size:11px;font-family: Arial;color:#6a7174;\"><small>Please do not reply to this email. If you have any questions, please contact our support desk. If you did not register to join <a href=\"http://www.example.net\" style=\"color:#ef6215;font-size:11px;\">example.net</a>, please ignore this email. Any accounts whose email is not validated within 30 days, will be deleted.</small></span>".
"</body></html>";
Obviously when it is final, some bits will be set with php variables - just using this for testing at the moment.
I wanted to do HTML based email to make it easier for the user, but it is seeming more and more like it makes it harder. :-/
[edited by: jatar_k at 4:53 pm (utc) on May 11, 2006]
[edit reason] examplified [/edit]
You may also want to look for tools that check the spam databases for your domain. If you are listed in the RBL, you'll have problems. If you are listed with any of the top five databases out there, you'll have some problems.
Managing email has become a full time proposition these days. ;)
But I assumed there must be a way to make trusted HTML emails, considering the number of companies that use them.
AOL Certified Email
[webmasterworld.com...]
EOC - Email Optimization Consultant
[webmasterworld.com...]
I ran the DNS Report on the domain, and it came back with 1 failure and 2 warnings - neither in the MX section. The rest are all pass and infos. I got the following failures/warnings:
------------------------------------
FAIL: No CNAMEs for domain - ERROR: I checked with your nameservers to see if there were any CNAMEs for fortheinter.net (there shouldn't be), but they all timed out.
WARN: Nameservers on separate class C's - WARNING: All of your nameservers (listed at the parent nameservers) are in the same Class C (technically, /24) address space, which means that they are probably at the same physical location. Your nameservers should be at geographically dispersed locations. You should not have all of your nameservers at the same location. RFC2182 3.1 goes into more detail about secondary nameserver location.
WARN: Mail server host name in greeting - WARNING: One or more of your mailservers is claiming to be a host other than what it really is (the SMTP greeting should be a 3-digit code, followed by a space or a dash, then the host name). If your mailserver sends out E-mail using this domain in its EHLO or HELO, your E-mail might get blocked by anti-spam software. This is also a technical violation of RFC821 4.3 (and RFC2821 4.3.1). Note that the hostname given in the SMTP greeting should have an A record pointing back to the same server. Note that this one test may use a cached DNS record.
mail.fortheinter.net claims to be host serenity.ikhost.net [but that host is at 72.20.4.14 (may be cached), not 72.20.12.88].
------------------------------------
Not exactly sure what these mean (I'm useless at the server/DNS side of websites), although the last one sounds as if it might be because I'm on shared hosting.
I tried the spam lookup at [dnsstuff.com...] and it came back with one failure (listed in database) for "SPEWS".
Would text based emails be more likely to get through than my HTML one?
Thanks for all the help.