This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| programmieren:wordpress:wp_mail_mit_smpt_daten_verschicken [2024/07/16 17:04] – [WP_MAIL mit einer SMTP-Verbindung verschicken (via PHPMailer)] jgehrke | programmieren:wordpress:wp_mail_mit_smpt_daten_verschicken [2024/07/16 17:16] (current) – [Hinweis zur SMPTSecure Einstellung] jgehrke | ||
|---|---|---|---|
| Line 3: | Line 3: | ||
| Oft ist sinnvoll wp_mail()' | Oft ist sinnvoll wp_mail()' | ||
| - | In Wordpress werden E-Mail über die Library PHPMailer verschickt, und die kommt von Haus aus mit einer Möglichkeit eine SMTP-Verbindung herzustellen. | + | In Wordpress werden E-Mail über die [[https:// |
| Das ist ein einfacher Beispiel Code wie man ohne Plugin eine SMTP Verbindung in Wordpress herstellen kann: | Das ist ein einfacher Beispiel Code wie man ohne Plugin eine SMTP Verbindung in Wordpress herstellen kann: | ||
| Line 61: | Line 61: | ||
| Eine einfachere Version des Codes gibt es [[https:// | Eine einfachere Version des Codes gibt es [[https:// | ||
| + | |||
| + | ===== Hinweis zur SMPTSecure Einstellung ===== | ||
| + | |||
| + | An dieser stelle wird eine Konstante übergeben, die auch in standard Systemen mit dem Port zusammen hängt: | ||
| + | |||
| + | <code txt> | ||
| + | PHPMailer:: | ||
| + | PHPMailer:: | ||
| + | </ | ||
| + | |||
| + | Man muss jedoch nicht die Konstanten des PHPMailers nutzen, mann kann auch Strings hinterlegen | ||
| + | |||
| + | < | ||
| + | $phpmailer-> | ||
| + | $phpmailer-> | ||
| + | </ | ||
| + | |||
| + | Das zeigt ein Blick in die [[https:// | ||
| ===== SMTP Klasse nutzen um Auth-Daten von ACF zu bekommen ===== | ===== SMTP Klasse nutzen um Auth-Daten von ACF zu bekommen ===== | ||
| Line 104: | Line 122: | ||
| public static function do_configure_phpmailer( PHPMailer $phpmailer ) | public static function do_configure_phpmailer( PHPMailer $phpmailer ) | ||
| { | { | ||
| + | self:: | ||
| + | |||
| // Exit falls SMTP gar nicht gewünscht ist, via ACF Optionen | // Exit falls SMTP gar nicht gewünscht ist, via ACF Optionen | ||
| if( !self:: | if( !self:: | ||
| Line 129: | Line 149: | ||
| private static function set_private_smtp_parameters() | private static function set_private_smtp_parameters() | ||
| { | { | ||
| - | self:: | + | self:: |
| - | self:: | + | self:: |
| - | self:: | + | self:: |
| - | self:: | + | self:: |
| - | self:: | + | self:: |
| - | self:: | + | self:: |
| - | self:: | + | self:: |
| } | } | ||
| } | } | ||
| </ | </ | ||