MOON
Server: Apache
System: Linux server.royaltuning.hu 4.18.0-425.13.1.el8_7.x86_64 #1 SMP Tue Feb 21 04:20:52 EST 2023 x86_64
User: royaltuning (1001)
PHP: 8.2.32
Disabled: exec,passthru,shell_exec,system
Upload Files
File: /home/royaltuning/public_html/public/wp-content/plugins/surbma-magyar-woocommerce/modules/smtp.php
<?php

/**
 * Module: SMTP service
 */

// Prevent direct access to the plugin
defined( 'ABSPATH' ) || exit;

// Configures WordPress PHPMailer
add_action( 'phpmailer_init', static function( $phpmailer ) {
	// Get the settings array
	global $cps_hc_gems_options;

	// SMTP port number - likely to be 25, 465 or 587
	$smtp_port = $cps_hc_gems_options['smtpport'] ?? 587;
	// Encryption system to use - ssl, tls, or empty string for no encryption
	$smtp_secure = $cps_hc_gems_options['smtpsecure'] ?? '';
	// SMTP From email address
	$smtp_from = $cps_hc_gems_options['smtpfrom'] ?? '';
	// SMTP From name
	$smtp_fromname = $cps_hc_gems_options['smtpfromname'] ?? '';
	// The hostname of the mail server
	$smtp_host = $cps_hc_gems_options['smtphost'] ?? '';
	// Username to use for SMTP authentication
	$smtp_user = $cps_hc_gems_options['smtpuser'] ?? '';
	// Password to use for SMTP authentication
	$smtp_password = $cps_hc_gems_options['smtppassword'] ?? '';

	if ( $smtp_host && $smtp_user && $smtp_password ) {
		$phpmailer->isSMTP();
		$phpmailer->Host = $smtp_host;
		$phpmailer->SMTPAuth = true;
		$phpmailer->Username = $smtp_user;
		$phpmailer->Password = $smtp_password;

		// Additional settings
		$phpmailer->Port = $smtp_port;
		$phpmailer->SMTPSecure = $smtp_secure;
		if ( $smtp_from ) {
			$phpmailer->From = $smtp_from;
		}
		if ( $smtp_fromname ) {
			$phpmailer->FromName = $smtp_fromname;
		}
	}
} );