Best practices for sending emails and avoiding spam [closed]

closed. this question is out of scope and is not currently accepting answers.

want to improve this question? Update the question so it's on-topic for Stack Overflow.

Closed 1 year ago .

improve this question

Nowadays, almost every web site or web system almost inevitably requires email sending functionality, whether in contact forms, password recovery, activation of account, Order Confirmation and etc.

What are the best practices to prevent these emails from being scored as spam?

  • What correct formatting of email header $headers .= "Content-type:text/html... ?
  • is CSS allowed for styling?
  • is image allowed, what is the best way to use it?
  • is there a recipient limit?
  • it is better to use the function mail () , or a class like PHPMailer for sending authenticated email?

In short, what are the main rules anti-spam to prevent emails from being scored as spam ?

Author: bio, 2014-05-06

2 answers

Email content is just one ingredient among "best practices for sending emails".

There are many other factors that influence the classification as spam or not.

IP address reputation

First, the IP address itself. For example: if your IP is in a low reputation range, this alone can be a reason to reject the email, regardless of everything else. I've had this experience: I hired a very cheap VPS provider, and I found that any email sent from their servers are automatically rejected by Yahoo! Mail. In short: the IP address reputation is an important factor. Serious, professional and modern providers with a strong anti-spam policy will have a good reputation and this does not become a problem.

DNS records

Another important technical factor is related to DNS records. Ideally, the IP address being used for submissions must be firmly associated with the domain of the sender address, including with reverse DNS properly configured. In addition, records SPF and Sender ID, as well as signatures DKIM and DomainKeys in all sent emails, are great measures to avoid the spam box and cultivate a high reputation as a sender. With every system I prepare for an application, I do all this work involving the DNS records and the signatures mentioned, and the result is usually " Inbox ", that is, no box of spam.

Ethical use

Also very important is as your server / application will make the submissions. Bought a list with millions of emails and sent the same ad to everyone? Reputation will plummet and submissions will be classified as spam . On the other hand, if your system behaves well , sending emails only to those who legitimately interact with your system, with "double opt-in" (that is, email confirmation / verification by sending a link), and following too many rules of ethical "behavior", without improper submissions, you are cultivating an excellent reputation. Maintaining email registration is another important task: sending emails to non-existent addresses, for example, inevitably happens over time, and it is important to keep track of bounces (returns), keeping the email registration base always as clean as possible.

The number of recipients can be huge, as long as your "list" has been built over time and is "true". Send a lot of emails suddenly to a lot of addresses... is spam .

When migrating a medium or large user base from one provider to another, you need to check with the provider for the usage rules for sending emails. I've traded with more from a provider and our server has been whitelisted, for the fact that we follow the best practices in sending (in the case, sending daily spiritual messages to about 6000 addresses - all registered of their own free will, with double opt-in, etc). Providers usually have a control/filtering/limit mechanism, but that can be disabled upon request, enabling larger quantity shipping.

Technical Care

Following the guidelines above and a few more technical care in sending the messages (correct and valid Return-Path, correct and valid sender address, correct SMTP protocol dialog), becomes almost irrelevant the content of the email, if your email is really honest and appropriate... in other words: case your email Don't really be spam, so it is very difficult for it to be classified as spam due to the content. (That said, of course there are various tips that boil down to nothing more than" common sense", avoiding overly" promotional " language, or obscene words, etc.)

Reader compatibility

Your specific questions, except about quantity of recipients, which we have already seen, are about: content-type, CSS, images, and mail() x PHPMailer.

Are pertinent and important questions, but very little relevant to the score as SPAM or not. In fact, an email that is just HTML with a image, without any text, can be considered suspicious. Other than that, the answer is "whatever", considering the question of punctuation as spam.

These questions are important yes to build emails that are correctly presented in as many environments as possible: Outlook, Thuderbird, Gmail, Yahoo, and other email readers, which are many. Yes, these answers need to be sought and best practices must be followed.

The best practices of HTML for email are quite different from those for web sites. In fact, they are even opposites. And they depend a lot on what you want. For simple transactional emails, it is sometimes preferable not to use HTML, but to stick with plain text. You can also rely on the model of the big sites, such as Twitter, Facebook, Google, etc. - as far as HTML is concerned.

CSS must be inline (attribute style). In general, the use of image should be restricted to decoration, and not be the main. But it depends: if your mailing is Product Catalog, it may be important to have the images of the products.

The mail () function can be used, but libraries like PHPMailer or others make coding a lot easier and are a good option. I think the most important thing is the "behind" structure... I usually install and configure Postfix to make the submissions...

email Deliverability it is a broad and extensive topic... I hope I helped a little.

 20
Author: J. Bruni, 2014-05-06 17:44:10

Are several questions you have ai. I will try to answer in the best possible way.

Remembering that depending on the case, the use of services such as MailChimp is the best option. The most basic plan is free and as your need grows, the plans become more"hairy" .

  1. What correct formatting of email header $headers .= "Content-type:text/html... ?
    $headers = " Content-type: text / html; charset = iso-8859-1 \ r \ n";

  2. Is it allowed to use CSS for styling?
    Yes, but this one is preferably in html.

  3. Is the use of image allowed, what is the best way to use?
    Yes, it is. However, it is highly recommended to use the Alt tags and not resize the images. If you need smaller ones, use photoshop.

  4. Is there a limit on recipients?
    No, although it is prudent to separate recipients in various groups and always include their Test email, to make sure that the sending took place well.

  5. Is it better to use the mail () function, or a class like PHPMailer for sending authenticated email?
    Personally I would use PHPMailer. But then I already fell for opinions, so I will not even try to defend the method.

Additionally, I found a link containing 20 best practice tips in creating email marketing. Think can list some:

  • Do not use background images;
  • Do not exceed 600px in width - most people who use outlook for example do not open their emails. Why stick a scrollbar instead of showing the whole message?
  • Test your application to see if emails are being sent to all providers;
  • Test your application in various browsers.

Good luck.

 12
Author: Filipe.Fonseca, 2014-05-06 17:39:47