MV framework logo
  • Architecture
    • Philosophy
    • Technologies
  • Admin Panel
  • Changelog
  • Support
  • Feedback
Download Version 2.6 from 07.10.2022
Documentation
  • Architecture
    • Philosophy
    • Technologies
  • Admin Panel
  • Changelog
  • Support
  • Feedback
Getting started
  • Installation and launch
  • System folders
  • Launch of simple website
  • Pre-installed models
  • System settings
Models
  • General principles of models
  • Data types
  • Model settings
  • Simple models
  • Foreign keys
  • Trees
  • Many to many
  • Group
  • Records management
  • Simple model management
  • Additional options
Views and routes
  • General principles of views
  • Router object
  • MV object
  • Index, default and 404 templates
  • Creating a new template
  • Data display in template
  • Object of Record class
  • Files and images
  • Date and time
  • Redirects
  • Email delivery
  • Special methods
Forms
  • Forms creation
  • Form fields settings
  • Form validation rules
  • Form validation process
  • Operations with form data
  • Using data from models
  • Form methods
SQL queries
  • Query constructor
  • Direct queries
  • Pagination
  • Sorting
  • Filtration
  • Upload from CSV files
Sessions and security
  • Work with sessions
  • AJAX
  • Security
  • Debugging
Plugins
  • General principles of plugins
  • Additions to admin panel
  • Caching
Documentation
Getting started
  • Installation and launch
  • System folders
  • Launch of simple website
  • Pre-installed models
  • System settings
Models
  • General principles of models
  • Data types
  • Model settings
  • Simple models
  • Foreign keys
  • Trees
  • Many to many
  • Group
  • Records management
  • Simple model management
  • Additional options
Views and routes
  • General principles of views
  • Router object
  • MV object
  • Index, default and 404 templates
  • Creating a new template
  • Data display in template
  • Object of Record class
  • Files and images
  • Date and time
  • Redirects
  • Email delivery
  • Special methods
Forms
  • Forms creation
  • Form fields settings
  • Form validation rules
  • Form validation process
  • Operations with form data
  • Using data from models
  • Form methods
SQL queries
  • Query constructor
  • Direct queries
  • Pagination
  • Sorting
  • Filtration
  • Upload from CSV files
Sessions and security
  • Work with sessions
  • AJAX
  • Security
  • Debugging
Plugins
  • General principles of plugins
  • Additions to admin panel
  • Caching

Email delivery

Delivery of email messages in MV is produced by 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("test@domain.com", "Good news", "Text of good news");
 
$recipients = array("test@domain.com", "test-2@domain.com", "test-3@domain.com");
$recipients = implode(",", $recipients);
$message = "Long text of good news ...";
Email :: send($recipients, "Good news",  $message);

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

Signatures and e-mail formatting

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.

Templates and CSS styles for emails are located in "customs/emais/default.php" file. You can change the template to the new one with a method of Email :: setTemplate("template_name"). File with a name "template_name.php" should be placed into "customs/emails/" folder.

Attention! When making 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="http://domain.com/client/">private room</a> on our website.</p>
<p>Order details</p> 
<ul> 
   <li>Product 1, $40.</li> 
   <li>Product 2, $20.</li> 
   <li>Product 3, $60.</li> 
</ul>

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" format.
  4. Additional headers 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 see error logs of Swift Mailer when sending emails set the "Mode" parameter in "config/setup.php" to "development".

Previous section

Redirects

Next section

Special methods

© 2012-2023, MV framework

MV tracker is based on open source MV framework
License