Why Gmail SMTP is not working?
-
I have enabled gmail smtp by manual code so that email from the contact form goes to inbox not spam. Also checked the php mail function in contact form X advanced setting. I have replaced the from email by a gmail, but contactform x still sending emails by my hosting. Is there any way to replace this by gmail? And I do not want to use a plugin.
I have added this code in my wp config-// SMTP email settings define( 'SMTP_USER', '[email protected]' ); define( 'SMTP_PASS', 'yourpassword' ); define( 'SMTP_HOST', 'smtp.gmail.com' ); define( 'SMTP_FROM', '[email protected]' ); define( 'SMTP_NAME', 'Demo' ); define( 'SMTP_PORT', '587' ); define( 'SMTP_SECURE', 'tls' ); define( 'SMTP_AUTH', true );
Then in my function php-
// Send email via SMTP add_action( 'phpmailer_init', 'my_phpmailer_example' ); function my_phpmailer_example( $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; }
Viewing 8 replies - 1 through 8 (of 8 total)
Viewing 8 replies - 1 through 8 (of 8 total)
- The topic ‘Why Gmail SMTP is not working?’ is closed to new replies.