Hello, I'm sending mail to users after they register, so they need to confirm their registration, but alot of time, the mail ends up in the spam box of the user or gets completely blocked, so they cannot finish their registrations. I'm using this code for the header of the mail: <? ... $header = "From: noreply@mydomainname.com\n"; $header .= "MIME-Version: 1.0\n"; $header .= "Content-Type: text/html; charset=iso-8859-1\n"; $header .= "X-Priority: 3\n"; $header .= "X-MSMail-Priority: Normal\n"; $header .= "X-Mailer: PHP / ".phpversion()."\n"; ... ?> Code (markup): The $mailcontent and $subject is simply a string. For the actual send of the mail i use: mail($mailaddress, $subject, $mailcontent , $header) What can i do to prevent this from happening?
Try setting the X-Mailer to something used by real mail clients like Outlook, Thunderbird etc. I dont know the exact values to use, but I will check and tell. Also make sure that the From address is valid. You can also try using PHPMailer. http://phpmailer.sourceforge.net/ Thomas
If you are sending an HTML e-mail, it is wise to include a plain-text version also. I understand this will reduce the number of false-positives from spam checkers.
Another vote for phpMailer - it's used by phpList and it generally gets through spam filters if the content is good. Try putting a bit more in the email than just a welcome, put an intro note and a reminder of the url where the site is etc. May help it look more like a regular email.
Another thought is to install spam assassin and send a test message to yourself and see what flags it triggers. They also have a guide about some things to do to help limit the chance of it being discarded as spam (not privelaged enough to post links so try google: AvoidingFpsForSenders) Are the users all using a specific client or all different clients?
I would recommend that you drop all that junk in the header and only send a plain text message. There is no reason to include any graphics or advertising crappola or redirection URLs because those are among the things that attract the attention of spam filter rule-sets. Your message should be sweet and simple: "Thank you for registering at www.XXX.com Code (markup): To gain full access to our (website or website or whatever), please go to the following URL to complete the registration process: http://www.XXX.com/registrartion.php?code=thisUsersCode Code (markup): Thank you! " Unless your domain is blacklisted, that kind of email is probably going to get through.
You can't always prevent it from happening, if you could then the spammers would use the same method.
Just another thought - you may also want to check your server's IP address against Spam Black Lists (here's a few), in case a spammer has used your IP address in the past.