MV framework logo
  • Architecture
  • Philosophy
  • Admin panel
  • Support
  • Feedback
Documentation
Download .zip version 3.2.0 from 25.12.2024
  • Architecture
  • Philosophy
  • Admin panel
  • Support
  • Feedback
Getting started
  • Installation and launch
  • Folder structure
  • Launching a simple website
  • Pre-installed models
  • SQLite getting started
  • System settings
  • Migrations
  • Debugging
Models
  • General principles of models
  • Data types
  • Model setup
  • Simple models
  • Foreign keys
  • Trees
  • Many to many
  • Group
  • Records management
  • Managing simple models
  • Additional features
Templates and routing
  • General principles of templates
  • Router object
  • MV object
  • Create a new template
  • Output of data in template
  • Record object
  • Files and images
  • Date and time
  • Redirects and http
  • Sending email
  • Special methods
Forms
  • Creating forms
  • Setting up form fields
  • Validating form fields
  • Form security
  • Working with form data
  • Using data from models
  • Form methods
SQL queries
  • Query builder
  • Direct queries
  • Pagination
  • Sorting
  • Filtration
Additional
  • AJAX
  • Plugins
  • Caching
  • Security
  • Admin panel add-ons
Documentation
Getting started
  • Installation and launch
  • Folder structure
  • Launching a simple website
  • Pre-installed models
  • SQLite getting started
  • System settings
  • Migrations
  • Debugging
Models
  • General principles of models
  • Data types
  • Model setup
  • Simple models
  • Foreign keys
  • Trees
  • Many to many
  • Group
  • Records management
  • Managing simple models
  • Additional features
Templates and routing
  • General principles of templates
  • Router object
  • MV object
  • Create a new template
  • Output of data in template
  • Record object
  • Files and images
  • Date and time
  • Redirects and http
  • Sending email
  • Special methods
Forms
  • Creating forms
  • Setting up form fields
  • Validating form fields
  • Form security
  • Working with form data
  • Using data from models
  • Form methods
SQL queries
  • Query builder
  • Direct queries
  • Pagination
  • Sorting
  • Filtration
Additional
  • AJAX
  • Plugins
  • Caching
  • Security
  • Admin panel add-ons
MV tracker

Sending email

In MV, mail is initially sent via the mail function, but you can configure sending via SMTP. In the core folder, there is a class file email.class.php, which contains the class and the send() method for sending messages. Messages are sent using the PHPMailer library.

SMTP configuration and the sender's address are located in the .env file
//General view of the method
Email::send($recipient, $subject, $message[, $headers, $attachments]);

//Sending a message
Email::send('test@domain.com', 'Good news', 'Text of the good news');

//Multiple recipients
$recipients = ['first@domain.com', 'second@domain.com', 'third@domain.com'];
$recipients = implode(',', $recipients);
$message = 'Long text of good news ...';
Email::send($recipients, 'Good news', $message);

//Additional headers
$headers = ['From' => 'info@mysite.com'];
Email::send($recipients, 'Good news', 'Text of good news', $headers);

//Sending email with attachment
$files = [Registry::get('IncludePath').'userfiles/files/price.pdf'];
Email::send($email, 'Our price list', $message, [], $files);

Signature and formatting of letters

The letter template and its CSS styles are in the customs/emais/default.php file, before sending the letter the template can be changed using the Email::setTemplate('template_name') method. The template_name.php file should also be in the customs/emails/ folder.

When forming the text of the letter using HTML tags, try not to make nested constructions, use simple techniques.

Important points

  1. Letters are sent in utf-8 encoding.
  2. The subject of the letter is also encoded in utf-8.
  3. The content type of the letter is text/html.
  4. Additional headers can be passed in the optional $headers parameter as an associated array.
  5. The sender's return address is set in the .env file, EMAIL_FROM setting.

Previous section

Redirects and http

Next section

Special methods
MV workshop banner
MV tracker

© 2014-2025, MV framework team

MV tracker project Github