Introduced MailerSend as an email provider with essential configuration options, including API key management and "reply-to" support. Enhanced email functionality by implementing a modular template system (header, footer, and content) for both text and HTML formats. Updated the existing email infrastructure to handle Stripe invoice notifications via MailerSend with conditional fallback planned for default SMTP services.
142 lines
4.5 KiB
PHP
142 lines
4.5 KiB
PHP
<?php
|
|
|
|
namespace email;
|
|
/** Universal */
|
|
require_once WD . '/modules/email/config/email_enabled_c.php';
|
|
require_once WD . '/modules/email/config/email_smtp_from_c.php';
|
|
require_once WD . '/modules/email/config/email_smtp_from_name_c.php';
|
|
require_once WD . '/modules/email/config/email_smtp_reply_to_c.php';
|
|
require_once WD . '/modules/email/config/email_smtp_reply_to_name_c.php';
|
|
|
|
/** SMTP */
|
|
require_once WD . '/modules/email/config/email_smtp_encryption_c.php';
|
|
require_once WD . '/modules/email/config/email_smtp_host_c.php';
|
|
require_once WD . '/modules/email/config/email_smtp_password_c.php';
|
|
require_once WD . '/modules/email/config/email_smtp_port_c.php';
|
|
require_once WD . '/modules/email/config/email_smtp_username_c.php';
|
|
/** Mailersend */
|
|
require_once WD . '/modules/email/config/email_mailersend_enabled_c.php';
|
|
require_once WD . '/modules/email/config/email_mailersend_api_key_c.php';
|
|
|
|
use email\config\email_enabled_c;
|
|
use email\config\email_mailersend_api_key_c;
|
|
use email\config\email_mailersend_enabled_c;
|
|
use email\config\email_smtp_encryption_c;
|
|
use email\config\email_smtp_from_c;
|
|
use email\config\email_smtp_from_name_c;
|
|
use email\config\email_smtp_host_c;
|
|
use email\config\email_smtp_password_c;
|
|
use email\config\email_smtp_port_c;
|
|
use email\config\email_smtp_reply_to_c;
|
|
use email\config\email_smtp_reply_to_name_c;
|
|
use email\config\email_smtp_username_c;
|
|
use traits\module_config_t;
|
|
|
|
class email_c
|
|
{
|
|
use module_config_t;
|
|
|
|
/**
|
|
* The status of reCAPTCHA, whether it is enabled or not
|
|
* @var email_enabled_c
|
|
*/
|
|
public email_enabled_c $enabled;
|
|
|
|
/**
|
|
* The SMTP host for the email service
|
|
* @var email_smtp_host_c
|
|
*/
|
|
public email_smtp_host_c $smtp_host;
|
|
|
|
/**
|
|
* The SMTP port for the email service
|
|
* @var email_smtp_port_c
|
|
*/
|
|
public email_smtp_port_c $smtp_port;
|
|
|
|
/**
|
|
* The SMTP username for the email service
|
|
* @var email_smtp_username_c
|
|
*/
|
|
public email_smtp_username_c $smtp_username;
|
|
|
|
/**
|
|
* The SMTP password for the email service
|
|
* @var email_smtp_password_c
|
|
*/
|
|
public email_smtp_password_c $smtp_password;
|
|
|
|
/**
|
|
* The SMTP encryption for the email service
|
|
* @var email_smtp_encryption_c
|
|
*/
|
|
public email_smtp_encryption_c $smtp_encryption;
|
|
|
|
/**
|
|
* The SMTP from email address for the email service
|
|
* @var email_smtp_from_c
|
|
*/
|
|
public email_smtp_from_c $smtp_from;
|
|
|
|
/**
|
|
* The SMTP from name for the email service
|
|
* @var email_smtp_from_name_c
|
|
*/
|
|
public email_smtp_from_name_c $smtp_from_name;
|
|
|
|
/**
|
|
* The status of Mailersend, whether it is enabled or not
|
|
* @var email_mailersend_enabled_c
|
|
*/
|
|
public email_mailersend_enabled_c $mailersend_enabled;
|
|
|
|
/**
|
|
* The API key for the Mailersend email service
|
|
* @var email_mailersend_api_key_c
|
|
*/
|
|
public email_mailersend_api_key_c $mailersend_api_key;
|
|
|
|
/**
|
|
* The email address to reply to
|
|
* @var email_smtp_reply_to_c The email address to reply to
|
|
*/
|
|
public email_smtp_reply_to_c $smtp_reply_to;
|
|
/**
|
|
* The name to reply to
|
|
* @var email_smtp_reply_to_name_c The name to reply to
|
|
*/
|
|
public email_smtp_reply_to_name_c $smtp_reply_to_name;
|
|
|
|
|
|
public function __construct()
|
|
{
|
|
$this->setupConfig('Email');
|
|
$this->allowUpdate([
|
|
email_enabled_c::class,
|
|
email_smtp_host_c::class,
|
|
email_smtp_port_c::class,
|
|
email_smtp_username_c::class,
|
|
email_smtp_password_c::class,
|
|
email_smtp_encryption_c::class,
|
|
email_smtp_from_c::class,
|
|
email_smtp_from_name_c::class,
|
|
email_mailersend_enabled_c::class,
|
|
email_mailersend_api_key_c::class,
|
|
email_smtp_reply_to_c::class,
|
|
email_smtp_reply_to_name_c::class
|
|
]);
|
|
$this->enabled = new email_enabled_c();
|
|
$this->smtp_host = new email_smtp_host_c();
|
|
$this->smtp_port = new email_smtp_port_c();
|
|
$this->smtp_username = new email_smtp_username_c();
|
|
$this->smtp_password = new email_smtp_password_c();
|
|
$this->smtp_encryption = new email_smtp_encryption_c();
|
|
$this->smtp_from = new email_smtp_from_c();
|
|
$this->smtp_from_name = new email_smtp_from_name_c();
|
|
$this->mailersend_enabled = new email_mailersend_enabled_c();
|
|
$this->mailersend_api_key = new email_mailersend_api_key_c();
|
|
$this->smtp_reply_to = new email_smtp_reply_to_c();
|
|
$this->smtp_reply_to_name = new email_smtp_reply_to_name_c();
|
|
}
|
|
|
|
} |