Sending Email with PHP and ensuring it doesn't get blocked

我们两清 提交于 2019-12-29 01:14:08

问题


I want to send an HTML email with PHP. I was wondering what headers should be used in the email to ensure it doesn't get blocked or end up in SPAM folders.

The email contents will contain CSS and HTML. The reply-to field will be different than the sender's ( will this affect anything? )

EDIT: I don't know why my question was voted down. Anyway, I'm not looking to email SPAM or mailing lists. The reason why I want the reply-to field to be different than the sender is because I'm creating a web app where a user manages jobs from various clients. Whenever a job is updated or created, the app will automatically send an email regarding job updates to the client. The client can then reply to the email to contact the user - that's why I need the reply-to field to be the user's email address.


回答1:


There are many different factors which take into account whether an email is blocked or not, headers play a part but also to consider are:

  • Consistent number of emails being sent day to day (100,000 once a month will damage your reputation more than 100,000 each day)
  • If you frequently email to bouncing addresses
  • Whether you are on the recipient's safe sender's list
  • The email provider you are sending to
  • Various DNS settings such as are you sending email from the domain your IP is registered to
  • Whether you frequently email invalid addresses
  • Whether you have been blacklisted by one of the blacklist companies
  • Various other email provider mechanism such as yahoo's domain key
  • The content of the email, avoid phrases like FREE, MONEY and LUCKY
  • Whether you include an unsubscribe link ( you MUST MUST provide an easy way to opt out of emails)

For one off emails you are often ok, if you plan to use your application to send frequent mailing lists it may be worth enlisting a third party company specialising in bulk email.




回答2:


Think about using a email sending service whose SLA (service Level Agreement) aligns with the deliverability rate you require.

There are a bunch of services that do this: SendGrid, Amazon SES, etc.

I suggest SendGrid because its relatively cheap and extremely easy to implement.

Also, this was an interesting read (not scholarly, but has some interesting insights): http://www.smashingmagazine.com/2007/10/16/best-practices-for-bulletproof-e-mail-delivery/




回答3:


Differing sender and reply-to fields can be a red flag for some spam filters (although not all), but the best approach to ensure delivery is to do everything by the book. Spam is often identified by the fact that it is similar to other spam, has some parts of the header differing from standard as you identified, or is sent from a server not authorised for that email domain (see sender policy frameworks for a good way to improve your chances and ask your hosting provider to set it up).



来源:https://stackoverflow.com/questions/9504911/sending-email-with-php-and-ensuring-it-doesnt-get-blocked

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!