Emails sent with PHP often end up in spam/junk folder

Posted by redtail, 03-07-2010, 07:32 PM
My website on VPS with Hostgator sends out emails to customers to confirm their purchase or send them a password and these emails often end up in the user's spam/junk folder. The users of my website often complain that they didn't receive an email, but when I ask them to check their spam folder it's always there. I asked Hostgator what I can do about this and they've told me to tell people to whitelist the email address that I use, but this is not very practical. I've put messages on the site to tell people to whitelist the address, but people don't read this. Does anyone have any tips on how to prevent this from happening? I'd realy appreciate any help. Thank you.

Posted by mattle, 03-08-2010, 05:20 PM
Hard to say...could be anything from a misconfiguration on your mail server to your messages failing a Bayesian filter. To test this thoroughly, I'd set up an account on a mail server you control, setup with spamassassin. Set the spam threshold really low, send one of your system generated messages to it and look in the X-Spam headers to find out what rules its triggering. You could also avoid the hassle of setting up the dummy account if you can just get one of your customers to forward the message to you (including full headers).

Posted by redtail, 03-08-2010, 05:38 PM
Thank you mattle. I can test it myself by sending it to my own Hotmail and the email ends up in Junk. There's no "X-Spam" in the headers though.

Posted by redtail, 03-08-2010, 05:40 PM
The headers do have this, but I don't know what it means: X-Message-Status: n:0 X-AUTH-Result: NONE

Posted by chrisranjana, 03-09-2010, 04:50 AM
Sometimes the SMTP server you use to send the emails might have been blacklisted for SPAM already.

Posted by tim2718281, 03-09-2010, 06:37 AM
Check your Hotmail options; setting junk filtering to "exclusive" means that all incoming mail will go in the junk folder, except mail from ids you have put in your contacts list or safe senders list. There's nothing the sender can do about it, it's completely controlled by the receiver. Here's the Hotmail help: Set the junk e-mail filtering level You can use the junk e-mail filter to help decrease the amount of junk e-mail that appears in your Inbox. 1. Sign in to the Windows Live Hotmail website with your Windows Live ID ( The user name and password that you use to sign in to any Windows Live, MSN, or Office Live sites and services. If you have a Passport Network, Hotmail, or Messenger account, you can use it as your Windows Live ID. ) . 2. On the Action bar, click Options, and then click More options. 3. Under Junk e-mail, click Filters and reporting. 4. Under Filters and reporting, select the options that you want, and then click Save. Notes * If you choose Exclusive for your junk e-mail filter, only messages from e-mail addresses on your Contacts or Allowed senders lists appear in your Inbox. Messages from senders not on those lists are automatically sent to the Junk folder. * You should occasionally check your Junk folder to make sure that good messages are not sent to there by mistake. If you notice a message that was inadvertently put in the Junk folder, open the Junk folder, select the message, and then, on the Action bar, click Not junk.

Posted by webcertain, 03-09-2010, 07:53 AM
this is cos php scripts (by default) send as the httpd user (nobody or apache) , rather than from an account. i'd recommend using an account to send, and then using a php script such as phpmailer to send via that account.

Posted by hostchunk, 03-09-2010, 08:22 AM
are you using php mailer? I remember having issues with spam and you can add a line to the headers so it thinks it's being sent from outlook not from the web. Helped solve our problem have a look on google for something similar

Posted by mattle, 03-09-2010, 11:01 AM
Then Hotmail's probably not something that will be useful to you That's why I originally recommended your own spamassassin setup so that you can see specifically what the problem is. I don't have a Hotmail account, but I doubt that it's sophisticated enough to tell you whysomething was flagged as spam...with a mail server that you control, you would see that. There have been some other good suggestions however, the easiest of which is making sure that you're setting the "From:" header on your outgoing email. Also, are you by any chance sending this from a server on a residential IP? Most black lists automatically flag mail from these IP ranges, which means in PHP, you either have to use SMTP, or in your mail server you would set all outgoing messages to use your ISP's mail server.

Posted by redtail, 03-09-2010, 12:04 PM
Thank you so much for all your help, but I'm still having the problem. My junk filtering settings are on Standard. I tried phpmailer and sending through an account with SMTP, but there was no difference. Do you remember what the code for the header to send via Outlook is? I cannot find this anywhere. I am using From headers, but my emails are still arriving in Hotmail's Junk folder.

Posted by mattle, 03-09-2010, 12:29 PM
Check your PM

Posted by redtail, 03-09-2010, 02:31 PM
I think it's solved now. My host helped me to enable DomainKeys and SPF Records on my domain and now when I send a test message to my Hotmail address it doesn't end up in Junk. It was actually really easy to enable these settings in cPanel under Email Authentication. I can't believe I never saw that before. It only works with sending through SMTP using phpmailer by the way. Any other way it still is marked as spam. Thank you for your help.

Posted by whmcsguru, 03-09-2010, 02:58 PM
Most free based mail provides will mark the mail from 'nobody' as spam. Since you're authenticating (using smtp/phpmailer), it's all good, but that's why most generic emails like this get marked as spam.

Posted by webdev2010, 03-12-2010, 02:22 AM
Ditto that, you have to authenticate or at minimum make sure if you are using mail() in PHP you modify the headers to not come from nobody.

¿Fue útil la respuesta?

 Imprimir éste Artículo

Leer también

IE 6.0 and style.display

Posted by jon31, 03-23-2007, 05:14 PMHey folks, I'm working on some cool little AJAX scripts,...