The cMailer class is an extension of the Swift Mailer class , which allows to send, resend or log emails from within CONTENIDO. cMailer 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
...
Create :
First, create an instance of the cMailer class like this:
Code Block | ||
---|---|---|
| ||
$mailer = new cMailer(); |
Get Then get a swift message instance and set the message data using its setter functionsmethods.
Code Block | ||
---|---|---|
| ||
$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.
Code Block | ||
---|---|---|
| ||
$mailer->send($message); |
...
Sending a mail with attachment
Get attachment instance, fill data and attach attachment to the message.
Code Block | ||
---|---|---|
| ||
$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 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.
...
In mailserver area you can configure all SMTP related configurations like host, user, password etc.