How to create spam safe webmail

I have a webmail that I’m sending out for my music to radio stations with links to where they can download the track.
Sometimes the e-mail ends up in their spam box and I just want to know how to make a webmail that is working with links that won’t end up as spam.

I know one thing could be that they add my address to their address book, but usually a lot of the people are new and don’t know me. So, I just want to know if there is a solution.

The code I’m including in my e-mail is also with a unique link, so I can use this to follow up who is downloading and who is not, so I include a code in php from the MySQL db to the link.

I guess it’s because I include an URL link in my e-mail that makes it end up as spam. Or could it be something else?

Are you using the mail() function?

Are you personalizing the e-mail by addressing each person individually (by name)?

Are you sending MIME messages that are correctly formed?

This is what I’m using.

$headers = "MIME-Version: 1.0" . "\\r\
$headers .= "Content-type:text/html;charset=iso-8859-1" . "\\r\
$headers .= "From: MyCompany<>" . "\
$headers .= "Reply-To: " . $myemail . "\
$headers .= "Bcc: " . $cc;

And it’s a loop adding each person separate in every e-mail as well.

Is there something wrong with my code here?

You are calling the mail() function, which will introduce odd headers and processing that spam filters can easily pick out. There is no ‘Bcc’ header in e-mail (‘Blind Carbon Copy’ - meaning two e-mails are supposed to be sent, not just one). Sending mixed case headers. There should be a space between ‘MyCompany’ and the ‘<’. Some of your newlines are CR-LF and some are just LF. Your message is likely plain-text and not addressed to each person by name.

This is why I don’t like the mail() function - it affords too much room for error, makes mistakes of its own, and lacks a lot of useful features. Plus e-mail coming from it is pretty obvious to spam filters.

Spam filters are tricky to get through, but having malformed e-mail is the primary way they detect spam. The code I’ve written has a better chance since it sends 100% RFC-compliant e-mails, but you’re still somewhat at the mercy of the recipient’s spam filter if you aren’t in their address book.

Thank you. I will take a deeper look at your stuff. It was a lot of info there.
Well, my message contains of html. All the design is made inside a table with links to images and backgrounds and so on.
Does your thing work anyway?

The best way to do this is to set up an SPF Record ( in your DNS for the server that’s sending the e-mails.

Also, use a library like PHPMailer or Swift mailer ( for better results (as thruska mentions, malformed e-mails and headers are always bad for spam scores).