PluginProbe
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder / 2.0
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder v2.0
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 2.10.2 All 137 releases
bit-form / includes / Core / Util / MailConfig.php

MailConfig.php in Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder 2.0, at includes/Core/Util/MailConfig.php

40 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace BitCode\BitForm\Core\Util;
4
5 use BitCode\BitForm\Core\Integration\IntegrationHandler;
6
7 /**
8 * Class handling plugin activation.
9 *
10 * @since 1.0.0
11 */
12 final class MailConfig {
13 public function sendMail() {
14 add_action('phpmailer_init', [$this, 'mailConfig'], 10, 1);
15 }
16
17 public function mailConfig($phpmailer) {
18 $integrationHandler = new IntegrationHandler(0);
19 $formIntegrations = $integrationHandler->getAllIntegration('mail', 'smtp', 1);
20 if (!isset($formIntegrations->errors['result_empty'])) {
21 if (1 === (int) $formIntegrations[0]->status) {
22 $integration_details = json_decode($formIntegrations[0]->integration_details);
23 $phpmailer->Mailer = 'smtp';
24 $phpmailer->Host = $integration_details->smtp_host;
25 $phpmailer->SMTPAuth = true;
26 if (!empty($integration_details->re_email_address)) {
27 $phpmailer->addReplyTo($integration_details->re_email_address, 'reply-to');
28 }
29 $phpmailer->Port = $integration_details->port;
30 $phpmailer->Username = $integration_details->smtp_user_name;
31 $phpmailer->Password = $integration_details->smtp_password;
32 $phpmailer->SMTPSecure = $integration_details->encryption;
33 $phpmailer->SMTP_DEBUG = 1;
34 $phpmailer->From = $integration_details->form_email_address;
35 $phpmailer->FromName = $integration_details->form_name;
36 }
37 }
38 }
39 }
40