Hi!

I've managed to put together a header in my mails that escapes both Gmail and Hotmail's mail filters, so I guess it's not all that bad. However, for my work mail, which has a very nasty filter, it gets stuck in quarantine. So I figured I should ask for some advice.

Here's the code ("xxx" is not there in my implementation, would be a great way to get stuck in spam filters if it were :)):

$header = "";
$header .= "Reply-To: xxx <postmaster@".$_SERVER['SERVER_NAME'].">\r\n";
$header .= "Return-Path: xxx <postmaster@".$_SERVER['SERVER_NAME'].">\r\n"; 
$header .= "From: xxx <postmaster@".$_SERVER['SERVER_NAME'].">\r\n";
$header .= "Organization: xxx \r\n"; 
$header .= "Content-Type: text/plain; charset=utf-8\r\n";

$sent = mail("xxx@xxx.xxx", "xxx", $message, $header);

Furthermore, it does get a unique message ID automatically. I've also checked that the host supports this "reverse DNS" thingy which I've heard about.

So, hope someone can help me out. Thanks!

Recommended Answers

All 6 Replies

Have you tried adding the X-Mailer header ? You can find it on the php.net mail page.

Added this now:

$header .= "X-Mailer: PHP/" . phpversion()."\n";

But still no luck, it gets stuck in quarantine. Any more ideas? :)

Oh, the site from where my script is running is Joomla based. Does that complicate things?

Added this now:

$header .= "X-Mailer: PHP/" . phpversion()."\n";

But still no luck, it gets stuck in quarantine. Any more ideas? :)

Oh, the site from where my script is running is Joomla based. Does that complicate things?

It shouldn't...

Is this to be used at your work site, or at least by other employees? If so, then I couldn't see why the SysAdmin wouldn't whitelist your server in the spam filter. It's a click or two away, even on the most complicated setups.

Is this a possibility? Just my 2¢.

Nah I'm just testing it here since I know our quarantine filter is set pretty strictly. We're developing it to be used at another work site so yeah, probably as a last option we can make sure it's allowed there.

I'm also thinking that maybe the "memory" of the quarantine filter causes it to end up there, since the earlier mails I tried had a lot less info in their headers.

Anyways, thanks for the replies!

Well there are two reasons as to why the mail function gets its mail stuck in spam. One is that the mail function does not function on the smtp protocol like other alternative functions. Another reason is spamming keywords are used and that the email from may not be a valid email address. Also when deciding the email from, make sure it is not only valid but not part of gmail, hotmail, yahoomail or any other public service as many spamming filters double check those types of from addresses. By saying double check I mean the mail needs to go though additional filtering layers and if it is from hotmail to hotmail for example it will be blocked completely. So my recommendation, make the email worded so it doesn't appear to filters as advertisement and when including links show the full url instead of a link title. And never put links in the subject of the email as that can be filtered too.

email without a title/subject header is routinely bounced

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.