The cMailer class is extension of Swift Mailer class, which allows send, resend or log emails from CONTENIDO.
cMailer class should be used for all mail sending purposes in CONTENIDO.
How it works? Send mail in 3 simple steps.
Create instance of cMailer class like this:
$mailer = new cMailer();
Get swift message instance and set message data using setter functions.
$from = "info@mail.example"; $to = "myaddress@mail.example"; $cc = "cc@mail.example"; $bcc = "bcc@mail.example"; $reply "replyto@mail.example"; $message = Swift_Message::newInstance(); $message->setFrom($from); $message->setTo($to); $message->setCc($cc); $message->setBcc($bcc); $message->setReplyTo($replyTo);
Send mail with message above by calling send method.
$mailer->send($message);
Send email with attachments.
Get attachment instance, fill data and attach attachment to the message.
$attachment = Swift_Attachment::newInstance($data, $filename, $contentType); $message->attach($attachment);
Email logging and configuration in Contenido
CONTENIDO provides email logging. The logs are stored in the database table con_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.