Forked from nextab/PHP Mailer Configuration for WordPress.php
Created
November 29, 2022 19:25
-
-
Save quangmai911/9bbfa85a1fc85c5df9f6369b45a908e0 to your computer and use it in GitHub Desktop.
Just define the globals in wp-config.php and add the code snippet in your functions.php to send e-mails via SMTP instead of the regular php mailer.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Folgenden Code unter übliche wp-config-.php-Befehle einfügen: (Auf All-Inkl angewandt - andere Host-Daten müssten dementsprechend angepasst werden...) | |
define( 'SMTP_USER', 'm05f2ew1' ); // Postfach-Benutzer | |
define( 'SMTP_PASS', 't3stpwd' ); // Postfach-Passwort | |
define( 'SMTP_HOST', 'w01c1234.kasserver.com' ); // Postein- und Ausgangsserver | |
define( 'SMTP_FROM', '[email protected]' ); // Gewünschte E-Mail-Adresse zum Versenden | |
define( 'SMTP_NAME', 'Example Website' ); // Webseiten-Name | |
define( 'SMTP_PORT', '465' ); // SMTP-Port - häufig 465 oder 587 (auch 25, aber unsicher) | |
define( 'SMTP_SECURE', 'ssl' ); // Verschlüsselungstyp (auch tls möglich) | |
define( 'SMTP_AUTH', true ); // SMTP-Authentifikation | |
define( 'SMTP_DEBUG', 0 ); // Debugging-Mode | |
Folgenden Code in die functions.php vom Child Theme einfügen: | |
add_action( 'phpmailer_init', 'send_smtp_email' ); | |
function send_smtp_email( $phpmailer ) { | |
$phpmailer->isSMTP(); | |
$phpmailer->Host = SMTP_HOST; | |
$phpmailer->SMTPAuth = SMTP_AUTH; | |
$phpmailer->Port = SMTP_PORT; | |
$phpmailer->Username = SMTP_USER; | |
$phpmailer->Password = SMTP_PASS; | |
$phpmailer->SMTPSecure = SMTP_SECURE; | |
$phpmailer->From = SMTP_FROM; | |
$phpmailer->FromName = SMTP_NAME; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment