Problems Sending Mails

Author: Christian Sommer (doc)

Mail function in WB 2.5.x - 2.6.4

Within the WB development process, the mail function was updated several times. Up to WB v2.6.4, mails are send by the PHP function mail() .

Disadvantages of the PHP mail() function

In some cases, mails send via PHP mail() did not receive the recipients although it was send by WB without any error message. The most common reasons for that issue are listed below.

  • wrong format of mail header or content (e.g. differences in line break between Windows/Unix)
  • sendmail not installed or configured on your server (php.ini)
  • the mail provider of the recipeint does not allow mails send by PHP mail(); common spam protection

Errors in the format of header or content can cause that mails are treated as SPAM. In the best case, such mails are transfered to the spam folder of your recipient inbox or send back to the sender. In the worst case, such mails are deleted without any comment. If sendmail is not installed or not configured, no mails can be send at all.

It is common practice by free mail provider such as GMX, to reject mails send via the PHP function mail(). Very often such mails are deleted without any information of the recipient.

Wrap up: PHP mail()
Sending mails via the PHP mail() function is not very reliable. Even if WebsiteBaker is able to send the mail corretly, it may not achieve your recipient. The only way which is promising for the future is using SMTP for outgoing mails.

Mail function since WB 2.6.5

Due to the bad experiences with the PHP mail() function, the new mailer class: PHPMailer was introduced with WB v2.6.5. Some features of this mail class are listed below.

  • choose between different mail functions like PHP mail() or SMTP
  • support of SMTP authentification (password and user name)
  • support of multiple TOs, CCs, BCCs und REPLY-TOs addresses
  • independent of the operating system used (Linux/Unix/Mac/Windows)
  • possible to add attachments
  • possible to send mails in HTML format

The integration of the new PHPMailer class was done in a way to ensure backwards compatibility. As in the previous WB versions, the default setting for outgoing mails is set to PHP mail().

Sending mails via SMTP

If your service provider does support outgoing mails via SMTP without authentification, you should change the default setting from PHP mail() to SMTP mail. The following information is required to use SMTP:

  • SMTP host (e.g. smtp.yourdomain.com)
  • ensure that no authentification is required (not supported so far)

The installation wizard of WebsiteBaker v2.6.5 give you the choice (step 7) between the two options: PHP mail() or SMTP mail. If you have upgradet from a previous WebsiteBaker version, one needs to modify the config.php file located in the root directory of your WB installation. Download the config.php file via FTP and add the following line:

define('WBMAILER_SMTP_HOST',
 'smtp.yourdomain.com');

Replace smtp.yourdomain.com by the SMTP host of your service provider. After uploading the modified config.php via FTP to your web server, outgoing mails are send by SMTP.

Premises for sending mails

To send mails via PHP mail() or SMTP from WebsiteBaker v2.6.5 onwards, the following premises needs to be fulfilled.

  • a formally valid FROM: address (of the used domain)
  • at least one formaly valid TO: address
  • a formally valid Server mail address (WB backend: Settings -> Show advanced Options)
Note:
Some free mail provider like GMX reject all mails which uses a GMX address (e.g. name@@gmx.net), but are not send via the GMX mail server.

Tip: To avoid such problems, one should use a FROM: address and Server mail following a syntax like: wbmailer@@yourdomain.com

Outlook:
WebsiteBaker 2.7 will allow to configure the mailer settings viat the WebsiteBaker backend. In addition the support for authentification will be included by default.

My server requires SMTP authentification

If your server requires SMTP authentification, you have to configure the mail settings in
Settings > Show Advanced Options > Mailer Settings

WB Mailer Settings