?? GreyFile — Mystic File Browser

Current path: home/webdevt/www/cryptoimpot.fr/wp-content/plugins/divi-contact-form-helper/app/Admin/Controllers/



?? Go up: /home/webdevt/www/cryptoimpot.fr/wp-content/plugins/divi-contact-form-helper/app/Admin

?? Viewing: SMTP.php

<?php

namespace KS_PAC_DCFH\Admin\Controllers;

if (!defined('ABSPATH')) {
    exit;
}

class SMTP
{
    public function init(): void
    {
        add_action('init', [$this, 'maybe_init']);
    }

    public function maybe_init(): void
    {
        if (!ks_pac_dcfh_db()::is_setting_enabled('pwh_dcfh_smtp_enabled')) {
            return;
        }
        $email_handler = Email_Handler::instance();
        add_action('phpmailer_init', [$this, 'maybe_setup_phpmailer']);
        $email_handler->set_mail_from_name(ks_pac_dcfh_db()::get_setting('pwh_dcfh_smtp_from_name'));
        $email_handler->set_mail_from(ks_pac_dcfh_db()::get_setting('pwh_dcfh_smtp_from_email'));
    }

    public function maybe_setup_phpmailer($php_mailer): void
    {
        $php_mailer->isSMTP();
        $smtp_autotls = ks_pac_dcfh_db()::is_setting_enabled('pwh_dcfh_smtp_autotls');
        $smtp_auth = ks_pac_dcfh_db()::is_setting_enabled('pwh_dcfh_smtp_authentication');
        $smtp_encryption = ks_pac_dcfh_db()::get_setting('pwh_dcfh_smtp_encryption');
        $php_mailer->Host = ks_pac_dcfh_db()::get_setting('pwh_dcfh_smtp_host');
        $php_mailer->Port = ks_pac_dcfh_db()::get_setting('pwh_dcfh_smtp_port');
        if ($smtp_auth) {
            $php_mailer->SMTPAuth = true;
            $php_mailer->Username = ks_pac_dcfh_db()::get_setting('pwh_dcfh_smtp_username');
            $php_mailer->Password = ks_pac_dcfh_db()::get_setting('pwh_dcfh_smtp_password');
        }
        if ('none' !== $smtp_encryption) {
            $php_mailer->SMTPSecure = $smtp_encryption;
        }
        if ($smtp_autotls && 'tls' !== $smtp_encryption) {
            $php_mailer->SMTPAutoTLS = true;
        }
    }
}


??

??