Advertisement
BeniSt

SMTP in WordPress

Jan 18th, 2021
1,161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.81 KB | None | 0 0
  1. define( 'SMTP_USER',   'user@example.com' );
  2. define( 'SMTP_PASS',   'smtp password' );
  3. define( 'SMTP_HOST',   'smtp.example.com' );
  4. define( 'SMTP_FROM',   'website@example.com' );
  5. define( 'SMTP_NAME',   'e.g Website Name' );
  6. define( 'SMTP_PORT',   '25' );
  7. define( 'SMTP_SECURE', 'tls' );
  8. define( 'SMTP_AUTH',    true );
  9. define( 'SMTP_DEBUG',   0 );                  
  10.  
  11. add_action( 'phpmailer_init', 'send_smtp_email' );
  12. function send_smtp_email( $phpmailer ) {
  13.     $phpmailer->isSMTP();
  14.     $phpmailer->Host       = SMTP_HOST;
  15.     $phpmailer->SMTPAuth   = SMTP_AUTH;
  16.     $phpmailer->Port       = SMTP_PORT;
  17.     $phpmailer->Username   = SMTP_USER;
  18.     $phpmailer->Password   = SMTP_PASS;
  19.     $phpmailer->SMTPSecure = SMTP_SECURE;
  20.     $phpmailer->From       = SMTP_FROM;
  21.     $phpmailer->FromName   = SMTP_NAME;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement