Child pages
  • cMailer
Skip to end of metadata
Go to start of metadata

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.

How does it work?

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 = "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);

// 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.

$mailer->send($message);

Sending a mail with attachment

Get attachment instance, fill data and attach attachment to the message.

 $attachment = Swift_Attachment::newInstance($data, $filename, $contentType);
 $message->attach($attachment);

Mail logging and configuration in CONTENIDO

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.

1 Comment

  1. Unknown User (faar)

    And what about sending HTML-Emails with embedded images? http://swiftmailer.org/docs/messages.html