Skip to content

Instantly share code, notes, and snippets.

@mahmutyukselmert
Created December 16, 2023 13:32
Show Gist options
  • Save mahmutyukselmert/f8ed50f746802a1f7970af31a25204c4 to your computer and use it in GitHub Desktop.
Save mahmutyukselmert/f8ed50f746802a1f7970af31a25204c4 to your computer and use it in GitHub Desktop.
WordPress sistemlerinizde basit SMTP işlemleri için bile eklenti kullanıldığını gördüm, bu işlemleri aşağıdaki kod eklemeleri ile hızlı bir şekilde yapabilirsiniz.
//theme functions.php for STMP Code.
add_action( 'phpmailer_init', 'my_phpmailer_smtp' );
function my_phpmailer_smtp( $phpmailer ) {
$phpmailer->isSMTP();
$phpmailer->Host = SMTP_server;
$phpmailer->SMTPAuth = SMTP_AUTH;
$phpmailer->Port = SMTP_PORT;
$phpmailer->Username = SMTP_username;
$phpmailer->Password = SMTP_password;
$phpmailer->SMTPSecure = SMTP_SECURE;
$phpmailer->From = SMTP_FROM;
$phpmailer->FromName = SMTP_NAME;
}
<?php
//wp-config.php for SMTP email settings
define( 'SMTP_username', 'youremail@gmail.com' ); // username
define( 'SMTP_password', 'gmail-app-password' ); // password
define( 'SMTP_server', 'smtp.gmail.com' ); // SMTP server address
define( 'SMTP_FROM', 'mail@example.com' ); // Email Address
define( 'SMTP_NAME', 'Name and Surname' ); // From Name
define( 'SMTP_PORT', '587' ); // Server Port Number
define( 'SMTP_SECURE', 'tls' ); // Encryption - ssl or tls
define( 'SMTP_AUTH', true ); // Use SMTP authentication (true|false)
define( 'SMTP_DEBUG', 0 ); // for debugging purposes only
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment