Email Delivery

Delivery of email messages in MV is done through Swift Mailer. By default, delivery of emails goes through mail function, it is possible to set up delivery through SMTP. In the core folder there is a file of "email.class.php" class where the class and "send()" method of e-mail delivery are defined.

Email :: send($recipient, $subject, $message[, $headers]);
Email :: send("", "Good news", "Text of good news");
$recipients = array("", "", "");
$recipients = implode(",", $recipients);
$message = "Long text of good news ...";
Email :: send($recipients, "Good news",  $message);

$headers = array("From" => "");
Email :: send($recipients, "Good news", "Text of good news", $headers);

Formatting E-mails and Signatures

To create a signature for all e-mails to be sent, go to "config/settings.php" file, there is an option "EmailSignature" which is added to the end of each e-mail (provided that the option is in the file and it is not empty). You are free to edit this signature the way you want. It also contains {domain} variable which is automatically replaced with the value of the "DomainName" option from the config/setup.php file.

When sending e-mails, css styles from "EmailCssStyles" option of "config/settings.php" file are added to HTML tags. Styles are added to tags in the form of "style" attribute. If the tag already had a "style" attribute, its value will be in a farther place in the final property list to save its priority.

Attention! When forming the body of e-mail with use of HTML tags avoid using nested constructions, use simple methods as shown in the example below.

<p>Dear, John</p>
<p>Your order was successfully received and processed.</p>
<p>You can track your order in your <a href="">private room</a> on our website.</p>
<p>Order details</p> 
   <li>Product 1, $40.</li> 
   <li>Product 2, $20.</li> 
   <li>Product 3, $60.</li> 

Important Notes

  1. Emails are sent in "utf-8" encoding.
  2. The subject of e-mail is also encoded in "utf-8".
  3. E-mail body type is "text/html".
  4. Additional titles can be passed in the optional parameter of $headers in the form of an associative array.
  5. Sender's address is specified in the "config/setup.php" file by "EmailFrom" parameter. The value should look like "John Johnson ", and also it can be changed when passing an additional parameter of "$headers" which itself may contain additional titles.
  6. To view error logs of Swift Mailer when sending emails set the "Mode" parameter in "config/setup.php" to "development".
  7. All these settings and also other parameters of sending emails can be changed in the "core/email.class.php" file.