| @@ -1,12 +1,8 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | namespace BitCode\BitForm\Core\Util; |
| 4 | 4 | |
| 5 | -if (!defined('ABSPATH')) { | |
| 6 | - exit; | |
| 7 | -} | |
| 8 | - | |
| 9 | 5 | use BitCode\BitForm\Core\Integration\IntegrationHandler; |
| 10 | 6 | |
| 11 | 7 | /** |
| 12 | 8 | * Class handling plugin activation. |
| @@ -27,30 +23,23 @@ | ||
| 27 | 23 | { |
| 28 | 24 | $integrationHandler = new IntegrationHandler(0); |
| 29 | 25 | $formIntegrations = $integrationHandler->getAllIntegration('mail', 'smtp', 1); |
| 30 | 26 | if (!isset($formIntegrations->errors['result_empty'])) { |
| 31 | - $integrationRow = Utilities::firstRow($formIntegrations); | |
| 32 | - if ($integrationRow && 1 === (int) $integrationRow->status) { | |
| 33 | - $integration_details = Utilities::jsonObj($integrationRow->integration_details ?? ''); | |
| 27 | + if (1 === (int) $formIntegrations[0]->status) { | |
| 28 | + $integration_details = json_decode($formIntegrations[0]->integration_details); | |
| 34 | 29 | $phpmailer->Mailer = 'smtp'; |
| 35 | - $phpmailer->Host = $integration_details->smtp_host ?? ''; | |
| 30 | + $phpmailer->Host = $integration_details->smtp_host; | |
| 36 | 31 | $phpmailer->SMTPAuth = true; |
| 37 | 32 | if (!empty($integration_details->re_email_address)) { |
| 38 | 33 | $phpmailer->addReplyTo($integration_details->re_email_address, 'reply-to'); |
| 39 | 34 | } |
| 40 | - $phpmailer->Port = $integration_details->port ?? ''; | |
| 41 | - $phpmailer->Username = $integration_details->smtp_user_name ?? ''; | |
| 42 | - $phpmailer->Password = $integration_details->smtp_password ?? ''; | |
| 43 | - $phpmailer->SMTPSecure = $integration_details->encryption ?? ''; | |
| 44 | - // $phpmailer->SMTPDebug = 1; | |
| 45 | - // $phpmailer->Debugoutput = 'error_log'; | |
| 46 | - $phpmailer->From = $integration_details->form_email_address ?? ''; | |
| 47 | - $phpmailer->Sender = $integration_details->form_email_address ?? ''; | |
| 48 | - if (isset($this->config['from_email']) && !empty($this->config['from_email'])) { | |
| 49 | - $phpmailer->From = $this->config['from_email']; | |
| 50 | - $phpmailer->Sender = $this->config['from_email']; | |
| 51 | - } | |
| 52 | - $from_name = $integration_details->form_name ?? ''; | |
| 35 | + $phpmailer->Port = $integration_details->port; | |
| 36 | + $phpmailer->Username = $integration_details->smtp_user_name; | |
| 37 | + $phpmailer->Password = $integration_details->smtp_password; | |
| 38 | + $phpmailer->SMTPSecure = $integration_details->encryption; | |
| 39 | + $phpmailer->SMTP_DEBUG = 1; | |
| 40 | + $phpmailer->From = $integration_details->form_email_address; | |
| 41 | + $from_name = $integration_details->form_name; | |
| 53 | 42 | if (isset($this->config['from_name']) && !empty($this->config['from_name'])) { |
| 54 | 43 | $from_name = $this->config['from_name']; |
| 55 | 44 | } |
| 56 | 45 | $phpmailer->FromName = $from_name; |