Code SMTP
Paste code to function.php in Child theme
// tu dong gui email
add_action( 'phpmailer_init', function( $phpmailer ) {
if ( !is_object( $phpmailer ) )
$phpmailer = (object) $phpmailer;
$phpmailer->Mailer = 'smtp';
$phpmailer->Host = 'smtp.gmail.com';
$phpmailer->SMTPAuth = 1;
$phpmailer->Port = 587;
$phpmailer->Username = 'Tài khoản';
$phpmailer->Password = 'Mật khẩu ứng dụng';
$phpmailer->SMTPSecure = 'TLS';
$phpmailer->From = 'Địa chỉ email gửi';
$phpmailer->FromName = 'Tên người gửi';
});
// ket thuc gui email tu dungTake Google app password
Click to link below and login to your gmail https://myaccount.google.com/u/1/security



You will receive your code by SMS


Click to App password and enter your email password again if required



Note: By the way, your email never in Spam. However Gmail limit allow us sending maximum 100 email/day, if exceed limit, them will sending after 24 hours.
Last updated