Author: Christian Sommer (doc)
This section provides information and possible traps when sending mails with Website Baker.
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().
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.
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 Website Baker 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.
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.
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().
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:
The installation wizard of Website Baker 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 Website Baker 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.
To send mails via PHP mail() or SMTP from Website Baker v2.6.5 onwards, the following premises needs to be fulfilled.
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
Outlock:
Website Baker 2.7 will allow to configure the mailer settings viat the Website Baker backend. In addition the support for authentification will be included by default.
If your server requires SMTP authentification, you need to add some PHP code lines to the file /framework/class.wbmailer.php. Download the file by the use of your FTP program and open it with your favorite text editor. Search for the following code section (starts around row 42)
function wbmailer() {
// set method to send out emails
if(defined('WBMAILER_SMTP_HOST')) {
// sets Mailer to send messages using SMTP
$this->IsSMTP();
$this->Host = WBMAILER_SMTP_HOST; // use STMP host defined in config.php
and add the following code lines:
$this->SMTPAuth = true; // SMTP with authentification
$this->Username = "xxxxxx"; // SMTP-Username
$this->Password = "xxxxxx"; // SMTP-Password
Replace xxxxx by the password and username required for the SMTP authentification. Save the text file and upload it via FTP to your webserver. Keep in mind to backup the original file. Clear the browser cache and log in to the WB backend. Sending mails should now work. Further information about this topic can be found in this forum thread.
Copyright (c) 2007 Website Baker Help team
Text and images of this page are licensed under a Creative Commons Attribution-NonCommercial-No Derivative 3.0 Licence. You are free to copy and distribute this work for noncommercial purposes as long as no changes are applied and this copyright notice and a backlink to http://help.websitebaker.org are provided.