diff --git a/framework/Theme.php b/framework/Theme.php index 5a8348d..aeceed1 100644 --- a/framework/Theme.php +++ b/framework/Theme.php @@ -150,6 +150,9 @@ protected function __construct() { add_filter( 'image_size_names_choose', array( $this, 'image_size_names_choose' ) ); + // Custom SMTP settings. + add_action( 'phpmailer_init', array( $this, 'phpmailer_init_smtp' ), 20 ); + /** * Remove Unnecessary Code from wp_head */ @@ -304,6 +307,24 @@ public function image_size_names_choose( $sizes ) { return $this->available_image_sizes; } + /** + * Redefine certain PHPMailer options with our custom ones. + * + * @param \PHPMailer $phpmailer The PHPMailer instance (passed by reference). + */ + public function phpmailer_init_smtp( $phpmailer ) { + if ( empty( JC_MAIL_USERNAME ) || empty( JC_MAIL_PASSWORD ) ) { + return; + } + + $phpmailer->isSMTP(); + $phpmailer->Host = JC_MAIL_HOST; + $phpmailer->SMTPAuth = true; + $phpmailer->Port = JC_MAIL_PORT; + $phpmailer->Username = JC_MAIL_USERNAME; + $phpmailer->Password = JC_MAIL_PASSWORD; + } + /** * Register styles and scripts *