PluginProbe
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder / 3.3.1
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder v3.3.1
3.3.1 V-3.3.0 3.2.2 3.2.1 3.2.0 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 V3.0.3 V3.0.2 -3.0.1 V_3.0.0 1.1.1 1.1.8 1.2 1.3 1.4 1.4.18 1.5.2 1.9 2.0 2.10.0 2.10.1 All 138 releases
← All changes | includes/Core/Util/MailConfig.php +22 -11 2.10.13.3.1 View file →
@@ -1,8 +1,12 @@
1 1 <?php
2 2
3 3 namespace BitCode\BitForm\Core\Util;
4 4
5 +if (!defined('ABSPATH')) {
6 + exit;
7 +}
8 +
5 9 use BitCode\BitForm\Core\Integration\IntegrationHandler;
6 10
7 11 /**
8 12 * Class handling plugin activation.
@@ -10,9 +14,9 @@
10 14 * @since 1.0.0
11 15 */
12 16 final class MailConfig
13 17 {
14 - private array $config;
18 + private $config;
15 19
16 20 public function sendMail($config = [])
17 21 {
18 22 $this->config = $config;
@@ -23,23 +27,30 @@
23 27 {
24 28 $integrationHandler = new IntegrationHandler(0);
25 29 $formIntegrations = $integrationHandler->getAllIntegration('mail', 'smtp', 1);
26 30 if (!isset($formIntegrations->errors['result_empty'])) {
27 - if (1 === (int) $formIntegrations[0]->status) {
28 - $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 ?? '');
29 34 $phpmailer->Mailer = 'smtp';
30 - $phpmailer->Host = $integration_details->smtp_host;
35 + $phpmailer->Host = $integration_details->smtp_host ?? '';
31 36 $phpmailer->SMTPAuth = true;
32 37 if (!empty($integration_details->re_email_address)) {
33 38 $phpmailer->addReplyTo($integration_details->re_email_address, 'reply-to');
34 39 }
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;
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 ?? '';
42 53 if (isset($this->config['from_name']) && !empty($this->config['from_name'])) {
43 54 $from_name = $this->config['from_name'];
44 55 }
45 56 $phpmailer->FromName = $from_name;