简体   繁体   中英

How to send emails from a php script that dont go to the spam folder (rules suggestions)

im developing a site who sends A LOT of emails notifications to my users from a php script who is running almost all the time, I will like to format the email mensage in order to make it non-spamm-like so my users can read the info non in the spam folder.

What suggestions do you can offer me? Do i need to use non html mensages? Is there some rules in the naming of the email address? (like no-reply@myhost.com)

I know there is not a 100% secure method, but i will like to make it the best possible. Thanks!

The email name won't be your issue with spam filters, most of them will be environmental.

The simplest way of making sure that your emails don't get spammed is to ensure the reverse lookups are correct for your MX records and from where the email is sent from. (Important for filters used by google and hotmail et al)

The second is to ensure that the HTML in the email is correctly formatted. Doddgy HTML formatting will cause some Spam filters to instantly class it as spam.

Other than that I would suggest also telling users to add the email address to their address book (hotmail et al) so that the spam filters see it as a not spam email.

Other than that I there are no other rules for emails that I can think of.

Hope that helps

To do that you probably have to configure DKIM/SPF.

DKIM

DomainKeys Identified Mail (DKIM) is a method for associating a domain name to an email

To setup DKIM in PHP you could have a look at this Stackoverflow topic

SPF

Sender Policy Framework (SPF), as defined in RFC 4408, is an e-mail validation system designed to prevent e-mail spam by tackling source address spoofing, a common vulnerability.

This link might help you setup DKIM and SPF.

List

Have a look at this list(more complete?) from Sendgrid:

在此处输入图像描述

Sengrid(outsource)

I don't think this is the most simple task. Luckily services like Sendgrid help you sent out emails without them being flagged as spam. They also provide a free plan(200 messages per day).

在此处输入图像描述

Also you have to keep in mind that when you sent a lot of emails you should be queuing your emails to sent out emails in a controlled manner(not overloading your server). This is also taking care of by third-party services to sent emails. Also if you are using shared hosting I don't think they will appreciate if you sent a lot emails because your resources are shared with all other users.

Alternatives

Some other alternatives to sendgrid are:

When searching Google you can find a lot more.

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