简体   繁体   中英

My server and php mail() function sends email to the spam folder

is there any way i install SMTP service on my Linux server and use php to send emails through it ?

so that emails doesn't show up as spam ?

maybe through ssl ?

my mail() function is perfect , with perfect headers , but still sending to spam :(

Thanks .

Cross-posting myself from another answer :

A few bullet points (Assuming that mail() returns true and there are no errors in the error log) :

  • Does the sender address ("From") belong to a domain on your server? If not, make it so.
  • Is your server on a blacklist (eg check IP on spamhaus.org)? This is a remote possibility with shared hosting.
  • Are mails filtered by a spam filter? Open an account with a freemailer that has a spam folder and find out. Also, try sending mail to an address without a spam filter.
  • Do you possibly need the fifth parameter "-f" of mail() to add a sender address? (See mail() command in the PHP manual)
  • If you have access to log files, check those, of course, as suggested above.
  • Do you check the "from:" address for possible bounce mails ("Returned to sender")? You can also set up a separate "errors-to" address.

There are plenty of variables that could potentially be involved here.

Your idea of a perfect header seems subjective. I would recommend you use something like PHPMailer or Swiftmailer to handle your mailing needs.

Some other variables you might need to take into account are the processing of bounced emails, and making sure you send your mail in chunks as opposed to one big send off.

您可以重新检查标题,也许地址标题中可能有空格或其他内容,您还可以检查服务器的IP是否列入黑名单(http://www.anti-abuse.org/multi-rbl-check/ )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM