问题
All my emails I am sending in local WAMP or on server, with PHP mail() function, goes to SPAM folder always.
While looking for the issue, I found we've to set headers like from id, reply to, return path, mime version, char type and charset.. I have set all of them, but still email goes to SPAM folder into my Gmail / Yahoo id, any clue?
All email addresses, which I am using in from/to/replyto/return path existing in real and still it goes to SPAM, very strange !
回答1:
Take a close look at the SMTP headers from the messages that are getting flagged as possible spam. Many spam filters will add a few lines listing the reasons a message was flagged; for example, if the sending IP address is blacklisted for some reason, there might be a header describing which blacklists you're listed in.
回答2:
What i've found locally that sendmail_from was not set into my WAMP, and once i used, ini_set('sendmail_from', 'some_valid_email_address'); it gets to Inbox !
Wohaaa... and working into live as well..
回答3:
That is one of the issues with mail
function. The better solution is to go for either of these:
- Swift Mailer
- PHPMailer
回答4:
One thing to do is to make sure that your HTML validates. It turns out that spammers are generally incapable of writing validating HTML and so this a huge tip off.
Another possibility is that you're on a shared host with another user that's a spammer. In this case, the whole IP range may have been banned.
Also, using red in your CSS and spammy words (think "free", "viagra", "act now", "sale", etc) are tip offs that some spam filters use.
The biggest thing that you can do to keep your emails out of spam folders is to only send emails to people that request them. This will keep people from reporting you as spam. If a lot of your emails get reported as spam, then your emails will get put in spam folders.
回答5:
try not including the "From: " this which might let the server think that you're spoofing.
来源:https://stackoverflow.com/questions/4623278/php-mail-function-gets-spam-email