Please note that this component has been marked as deprecated in version 2.0. Please use another solution (e.g. PHPM@iler) since the code is removed in version 2.1.

The class mailSender provides an easy-to-use mail delivering layer. It enables the developer to create and send mails adventure style like.

The following code snippet shows an easy example:

PHP code
$sender = &$this->getAndInitServiceObject('APF\tools\mail\mailSender', 'Standard'); $sender->setSubject('My Subject'); $sender->setContent('My Text'); $sender->setRecipient('', 'Your Name'); $sender->sendMail();

In order to send an e-mail to more than one recipient the method setRecipient() can be used several times. Another alternative is to utilize the setCCRecipient() method to add CC recipients to the mail. Adding BCC recipients is supported by the setBCCRecipient() method.

A detailed example can be found in the Contact form chapter.

To use this component it must be configured prior to use. Therefor a configuration file with the name


must be stored in the folder


The second parameter used in the function call of the getAndInitServiceObject() methode above specifies the configuration section to use. Each section must contain the following configuration keys:

APF configuration
[{section name}] Mail.SenderName = "" Mail.SenderEMail = "" Mail.ReturnPath = "" Mail.ContentType = "text/plain; charset=utf-8"

Mail.ContentType can be filled with any valid MIME type definition. The configuration file can contain any amount of sections so that the mailSender can be used in various modules within one application in parallel.


Do you want to add a comment to the article above, or do you want to post additional hints? So please click here. Comments already posted can be found below.
There are no comments belonging to this article.

In order to provide a state-of-the-art web experience and to continuously improve our services we are using cookies. By using this web page you agree to the use of cookies. For more information, please refer to our Privacy policy.