PluginProbe
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder / 2.15.3
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder v2.15.3
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 +34 -21 1.22.15.3 View file →
@@ -10,27 +10,40 @@
10 10 * @since 1.0.0
11 11 */
12 12 final class MailConfig
13 13 {
14 - public function sendMail()
15 - {
16 - add_action('phpmailer_init', [$this,'mailConfig'], 10, 1);
14 + private $config;
15 +
16 + public function sendMail($config = [])
17 + {
18 + $this->config = $config;
19 + add_action('phpmailer_init', [$this, 'mailConfig'], 10, 1);
20 + }
21 +
22 + public function mailConfig($phpmailer)
23 + {
24 + $integrationHandler = new IntegrationHandler(0);
25 + $formIntegrations = $integrationHandler->getAllIntegration('mail', 'smtp', 1);
26 + if (!isset($formIntegrations->errors['result_empty'])) {
27 + if (1 === (int) $formIntegrations[0]->status) {
28 + $integration_details = json_decode($formIntegrations[0]->integration_details);
29 + $phpmailer->Mailer = 'smtp';
30 + $phpmailer->Host = $integration_details->smtp_host;
31 + $phpmailer->SMTPAuth = true;
32 + if (!empty($integration_details->re_email_address)) {
33 + $phpmailer->addReplyTo($integration_details->re_email_address, 'reply-to');
34 + }
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;
42 + if (isset($this->config['from_name']) && !empty($this->config['from_name'])) {
43 + $from_name = $this->config['from_name'];
44 + }
45 + $phpmailer->FromName = $from_name;
46 + }
17 47 }
18 - function mailConfig($phpmailer)
19 - {
20 - $integrationHandler = new IntegrationHandler(0);
21 - $formIntegrations = $integrationHandler->getAllIntegration('mail','smtp',1);
22 - if(!$formIntegrations->errors['result_empty']){
23 - $integration_details = json_decode($formIntegrations[0]->integration_details);
24 - $phpmailer->Mailer = 'smtp';
25 - $phpmailer->Host = $integration_details->smtp_host;
26 - $phpmailer->SMTPAuth = true;
27 - $phpmailer->Port = $integration_details->port;
28 - $phpmailer->Username = $integration_details->smtp_user_name;
29 - $phpmailer->Password = $integration_details->smtp_password;
30 - $phpmailer->SMTPSecure = $integration_details->encryption;
31 - $phpmailer->SMTP_DEBUG = 1;
32 - $phpmailer->From = $integration_details->form_email_address;
33 - $phpmailer->FromName = $integration_details->form_name;
34 - }
35 - }
48 + }
36 49 }