![]() |
VOOZH | about |
The Email System in Maho handles all transactional emails through Mage_Core_Model_Email_Template, providing template management, variable substitution via Mage_Core_Model_Email_Template_Filter, email queueing through Mage_Core_Model_Email_Queue, and transport integration with Symfony Mailer. Email templates are stored in the core_email_template database table or loaded from locale files.
Configuration Location: System > Configuration > System > Mail Sending Settings (system/smtp)
Sources: app/code/core/Mage/Core/Model/Email/Template.php1-73 app/code/core/Mage/Core/Model/Email/Template.php77-80
The following diagram illustrates the flow from template storage to delivery, highlighting the modernization using Symfony components.
Sources: app/code/core/Mage/Core/Model/Email/Template.php13-15 app/code/core/Mage/Core/Model/Email/Template.php77-80 app/code/core/Mage/Core/Model/Email/Template.php111-119 app/code/core/Mage/Core/Model/Email/Template.php140-154
Template system class hierarchy and key methods:
| Class | Key Methods | Purpose |
|---|---|---|
Mage_Core_Model_Email_Template | loadByCode($templateCode) | Load custom template by unique code from core_email_template app/code/core/Mage/Core/Model/Email/Template.php127-131 |
loadDefault($templateId, $locale) | Load system default template file from locale translation app/code/core/Mage/Core/Model/Email/Template.php140-180 | |
send($email, $name, $variables) | Send email using provided variables and Symfony Mailer app/code/core/Mage/Core/Model/Email/Template.php23-29 | |
getTemplateFilter() | Instantiate or retrieve Mage_Core_Model_Email_Template_Filter app/code/core/Mage/Core/Model/Email/Template.php111-119 | |
Mage_Core_Model_Email_Template_Filter | setUseAbsoluteLinks($value) | Configure if links in email should be absolute app/code/core/Mage/Core/Model/Email/Template.php67-71 |
Sources: app/code/core/Mage/Core/Model/Email/Template.php72-120 app/code/core/Mage/Core/Model/Email/Template.php127-180
Email templates are loaded via methods on Mage_Core_Model_Email_Template:
| Method | Parameters | Source | Usage |
|---|---|---|---|
loadByCode($templateCode) | string $templateCode | core_email_template table | Load custom template by code app/code/core/Mage/Core/Model/Email/Template.php127-131 |
loadDefault($templateId, $locale) | string $templateId, string $locale | Locale files | Load system default template app/code/core/Mage/Core/Model/Email/Template.php140-180 |
System default templates are registered in module configuration under the path defined by XML_PATH_TEMPLATE_EMAIL (global/template/email). The loadDefault method parses template files for specific metadata blocks:
<!--@subject ... @--> - Parsed using regex to set template_subject app/code/core/Mage/Core/Model/Email/Template.php156-159<!--@vars ... @--> - Parsed to set orig_template_variables app/code/core/Mage/Core/Model/Email/Template.php161-164<!--@styles ... @--> - Parsed to set template_styles app/code/core/Mage/Core/Model/Email/Template.php166-169Sources: app/code/core/Mage/Core/Model/Email/Template.php77 app/code/core/Mage/Core/Model/Email/Template.php156-169
Maho replaces legacy mail implementations with Symfony Mailer. This integration uses Symfony\Component\Mime for message construction and Symfony\Component\Mailer for delivery.
Sources: app/code/core/Mage/Core/Model/Email/Template.php13-15 app/code/core/Mage/Core/Model/Email/Template.php23-29
Maho supports queuing emails to improve frontend performance. When queuing is enabled, emails are not sent immediately but are stored in the core_email_queue table.
Mage_Core_Model_Email_QueueMage_Core_Model_Email_Template maintains a reference to the queue via setQueue() and getQueue() app/code/core/Mage/Core/Model/Email/Template.php55-56Sources: app/code/core/Mage/Core/Model/Email/Template.php55-56
Administrators configure SMTP settings and sender identities in the Admin Panel.
| Path | Constant | Description |
|---|---|---|
system/smtp/set_return_path | XML_PATH_SENDING_SET_RETURN_PATH | Toggle for custom return path app/code/core/Mage/Core/Model/Email/Template.php78 |
system/smtp/return_path_email | XML_PATH_SENDING_RETURN_PATH_EMAIL | Address for bounced emails app/code/core/Mage/Core/Model/Email/Template.php79 |
global/template/email | XML_PATH_TEMPLATE_EMAIL | Registry of all default email templates app/code/core/Mage/Core/Model/Email/Template.php77 |
The configuration UI is managed by Mage_Adminhtml_System_ConfigController, which handles the saving of all system settings including SMTP app/code/core/Mage/Adminhtml/controllers/System/ConfigController.php122-196
Maho includes a built-in test email feature within the System Configuration to verify SMTP settings.
Mage_Adminhtml_System_Config_TestEmailController handles the AJAX request via sendAction() app/code/core/Mage/Adminhtml/controllers/System/Config/TestEmailController.php32-82Mage_Adminhtml_Block_System_Config_Form_Field_TestEmail and the template system/config/testemail.phtml app/design/adminhtml/default/default/template/system/config/testemail.phtml1-81mahoFetch to send the test request to the configured AJAX URL app/design/adminhtml/default/default/template/system/config/testemail.phtml56-72Sources: app/code/core/Mage/Core/Model/Email/Template.php77-80 app/code/core/Mage/Adminhtml/controllers/System/ConfigController.php122-196 app/code/core/Mage/Adminhtml/controllers/System/Config/TestEmailController.php32-82 app/design/adminhtml/default/default/template/system/config/testemail.phtml41-73
Refresh this wiki