Friday, 25 March 2016

Please use SMTP instead of mail().

Maybe this is a bit of a rant, but frankly I am getting tired of dealing with so many developers who are taking the easy route with form creation and relying on mail() to make things "just work".

Generally referred to by many different names such as mail(), phpmail(), wpmail() (wordpress), Sendmail, and so on but at the core all have the same problems and this has got to be one of the most irritating things that those of us trying to diagnose your issues have to deal with.

The most common issue is "email from form not received" and all to often we see that this is due to the use of mail() function.

While in the past this was a good quick function to use, as email providers are trying to crack down on spam this is causing many headaches now.

Most commonly because:

  1. mail() generally sends out email as cpanelusername@servername instead of an actual email address.

  2. Even in scripts where you specify an email address as the sending address, this is done via "spoofing" the email address and headers for a received email often still show cpanelusername@servername

  3. There are limited logs available when using this function. Most hosting companies the L1s will not have access to these logs and frankly its a waste of time for a systems administrator to take a look. There is also the problem that usually while a L1 can fix many issues quickly, if we have to bring in L2 its going to take a lot longer. These logs are often recycled, so if you do not receive an email from a form sent 2 days ago and are trying to find out why, most likely there wont be any logs available.

  4. Many spam filters will filter out these emails.

SMTP usage:

  1. This has the benefit of actually originating from a valid email address.

  2. More logs are generated, usually L1 techs have access to these logs.

  3. Less chance of being filtered out via spam filters.

Use scenario:

Say you have a website hosted at Host1.com with a form that your viewers can submit information through.

This form is configured to send to your @gmail.com email address and uses your @gmail.com email address as the "sending" address.

Gmail will usually filter this out as spam as the email is originating from a non-gmail server and your server is not listed as an authorized sender in gmail SPF record.

If you were to use SMTP to connect to the gmail servers to send as your gmail email address, this means it will be sent from the gmail server to your address and decreases the chance of filtering occurring.

Even when you are having mail() send to an email address on your own domain your own filtering may cause you to not receive the emails.

While there are many scripts out there for mail() usage, there are just as many available for SMTP.

CMS scripts such as Joomla, WordPress, Drupal, or so on generally have built in SMTP functionality or through the use of plugins (usually WP) you can give SMTP functionality.

NOTE: If you use gravity forms and have recently started having issues with this, install SMTP plugin to fix.

Here is an article that goes into more detail on mail() vs SMTP

While SMTP configuration may take a little bit longer to setup and must be configured individually for each domain, the long term benefits for both developers as well as the techs that must support you are much better.

Please be nice, decrease headaches, and use SMTP instead of mail()?

SRC: Work for a hosting company and deal with this a few times a day.



Epic visual tool

Epson 5030UB 2D/3D 1080p 3LCD Projector Submitted March 25, 2016 at 08:39PM by LeaveTheMatrix http://ift.tt/1q6qaT8

No comments:

Post a Comment