VOOZH about

URL: https://deepwiki.com/MahoCommerce/maho/5.4-email-system

⇱ Email System | MahoCommerce/maho | DeepWiki


Loading...
Last indexed: 15 May 2026 (ea8ab8)
Menu

Email System

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

System Architecture

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

Core Classes and Methods

Template system class hierarchy and key methods:

ClassKey MethodsPurpose
Mage_Core_Model_Email_TemplateloadByCode($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_FiltersetUseAbsoluteLinks($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

Template Loading and Storage

Email templates are loaded via methods on Mage_Core_Model_Email_Template:

Loading Methods

MethodParametersSourceUsage
loadByCode($templateCode)string $templateCodecore_email_template tableLoad custom template by code app/code/core/Mage/Core/Model/Email/Template.php127-131
loadDefault($templateId, $locale)string $templateId, string $localeLocale filesLoad system default template app/code/core/Mage/Core/Model/Email/Template.php140-180

Default Template Registration

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:

Sources: app/code/core/Mage/Core/Model/Email/Template.php77 app/code/core/Mage/Core/Model/Email/Template.php156-169

Symfony Mailer Integration

Maho replaces legacy mail implementations with Symfony Mailer. This integration uses Symfony\Component\Mime for message construction and Symfony\Component\Mailer for delivery.

Data Flow for Sending


Sources: app/code/core/Mage/Core/Model/Email/Template.php13-15 app/code/core/Mage/Core/Model/Email/Template.php23-29

Email Queuing

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.

Sources: app/code/core/Mage/Core/Model/Email/Template.php55-56

Admin Configuration and Test Email

Administrators configure SMTP settings and sender identities in the Admin Panel.

Configuration Paths

PathConstantDescription
system/smtp/set_return_pathXML_PATH_SENDING_SET_RETURN_PATHToggle for custom return path app/code/core/Mage/Core/Model/Email/Template.php78
system/smtp/return_path_emailXML_PATH_SENDING_RETURN_PATH_EMAILAddress for bounced emails app/code/core/Mage/Core/Model/Email/Template.php79
global/template/emailXML_PATH_TEMPLATE_EMAILRegistry of all default email templates app/code/core/Mage/Core/Model/Email/Template.php77

System Config Controllers

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

Test Email Functionality

Maho includes a built-in test email feature within the System Configuration to verify SMTP settings.


Sources: 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