The cMailer class is an extension of the Swift Mailer class which allows to send, resend or log emails within CONTENIDO. This class should be used for all mail sending purposes in CONTENIDO.
Sending a mail can be done in three simple steps:
First, create an instance of the cMailer class like this:
$mailer = new cMailer();
Then get a swift message instance and set the message data using its setter methods.
$from = "email@example.com"; $to = "firstname.lastname@example.org"; $cc = "email@example.com"; $bcc = "firstname.lastname@example.org"; $reply "email@example.com"; $message = Swift_Message::newInstance(); $message->setFrom($from); $message->setTo($to); $message->setCc($cc); $message->setBcc($bcc); $message->setReplyTo($replyTo); // Give it a body $message->setBody('Here is the message itself');
Eventually send the mail with the above created message by calling the mailers send() method.
Get attachment instance, fill data and attach attachment to the message.
$attachment = Swift_Attachment::newInstance($data, $filename, $contentType); $message->attach($attachment);
CONTENIDO provides email logging. The logs are stored in the Database table mail_log.
Email logs are placed in CONTENIDO backend unter Administration -> Logs -> Mails. You can see there all logged mails with their content and additional informations.
It is also possible delete there one or more logged mails.
If you want deactivate logging, go to Administration -> System -> System configuration find Mailserver area and uncheck Log mails.
In mailserver area you can configure all SMTP related configurations like host, user, password etc.