php mail() function gets spam email

后端 未结 6 1820
野趣味
野趣味 2020-12-11 19:42

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 heade

相关标签:
6条回答
  • 2020-12-11 20:12

    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.

    0 讨论(0)
  • 2020-12-11 20:24

    I had the same problem and nothing worked.

    I found out, that no line in the message is allowed to have more than 70 characters. Solution is to add wordwrap after the message.

    $message= wordwrap($message, 70, "\r\n");

    0 讨论(0)
  • 2020-12-11 20:30

    try not including the "From: " this which might let the server think that you're spoofing.

    0 讨论(0)
  • 2020-12-11 20:33

    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.

    0 讨论(0)
  • 2020-12-11 20:35

    That is one of the issues with mail function. The better solution is to go for either of these:

    • Swift Mailer
    • PHPMailer
    0 讨论(0)
  • 2020-12-11 20:36

    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..

    0 讨论(0)
提交回复
热议问题