| @@ -27,29 +27,30 @@ | ||
| 27 | 27 | { |
| 28 | 28 | $integrationHandler = new IntegrationHandler(0); |
| 29 | 29 | $formIntegrations = $integrationHandler->getAllIntegration('mail', 'smtp', 1); |
| 30 | 30 | if (!isset($formIntegrations->errors['result_empty'])) { |
| 31 | - if (1 === (int) $formIntegrations[0]->status) { | |
| 32 | - $integration_details = json_decode($formIntegrations[0]->integration_details); | |
| 31 | + $integrationRow = Utilities::firstRow($formIntegrations); | |
| 32 | + if ($integrationRow && 1 === (int) $integrationRow->status) { | |
| 33 | + $integration_details = Utilities::jsonObj($integrationRow->integration_details ?? ''); | |
| 33 | 34 | $phpmailer->Mailer = 'smtp'; |
| 34 | - $phpmailer->Host = $integration_details->smtp_host; | |
| 35 | + $phpmailer->Host = $integration_details->smtp_host ?? ''; | |
| 35 | 36 | $phpmailer->SMTPAuth = true; |
| 36 | 37 | if (!empty($integration_details->re_email_address)) { |
| 37 | 38 | $phpmailer->addReplyTo($integration_details->re_email_address, 'reply-to'); |
| 38 | 39 | } |
| 39 | - $phpmailer->Port = $integration_details->port; | |
| 40 | - $phpmailer->Username = $integration_details->smtp_user_name; | |
| 41 | - $phpmailer->Password = $integration_details->smtp_password; | |
| 42 | - $phpmailer->SMTPSecure = $integration_details->encryption; | |
| 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 ?? ''; | |
| 43 | 44 | // $phpmailer->SMTPDebug = 1; |
| 44 | 45 | // $phpmailer->Debugoutput = 'error_log'; |
| 45 | - $phpmailer->From = $integration_details->form_email_address; | |
| 46 | - $phpmailer->Sender = $integration_details->form_email_address; | |
| 46 | + $phpmailer->From = $integration_details->form_email_address ?? ''; | |
| 47 | + $phpmailer->Sender = $integration_details->form_email_address ?? ''; | |
| 47 | 48 | if (isset($this->config['from_email']) && !empty($this->config['from_email'])) { |
| 48 | 49 | $phpmailer->From = $this->config['from_email']; |
| 49 | 50 | $phpmailer->Sender = $this->config['from_email']; |
| 50 | 51 | } |
| 51 | - $from_name = $integration_details->form_name; | |
| 52 | + $from_name = $integration_details->form_name ?? ''; | |
| 52 | 53 | if (isset($this->config['from_name']) && !empty($this->config['from_name'])) { |
| 53 | 54 | $from_name = $this->config['from_name']; |
| 54 | 55 | } |
| 55 | 56 | $phpmailer->FromName = $from_name; |