Support » Plugin: Contact Form X » 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', 'youremail@example.com' );
    define( 'SMTP_PASS', 'yourpassword' );
    define( 'SMTP_HOST', 'smtp.gmail.com' );
    define( 'SMTP_FROM', 'youremail@example.guru' );
    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)
  • Thread Starter Md. Redwan Hossain

    (@redwancou)

    update- I used fluent smtp plugin and tried with sendinblue, google cloud api, gmail direct smtp but it is still using my hosting email.
    What should I do to use smtp?

    Plugin Author Jeff Starr

    (@specialk)

    Yeah CFX doesn’t support any SMTP functionality at this time, so that might explain it. The closest thing that I can think of that might help, CFX provides a setting under the Advanced tab called “Mail Function” that you can try to enable. Doing so tells the plugin to use PHP mail() function instead of wp_mail() to send the emails.

    • This reply was modified 3 months, 2 weeks ago by Jeff Starr.
    Thread Starter Md. Redwan Hossain

    (@redwancou)

    Tried Php mail but result is same. If you can add smtp support, it will be a huge feature as hosting’s email goes to spam folder.

    Plugin Author Jeff Starr

    (@specialk)

    Added to the list. Thanks for the feedback, @redwancou. Feel free to post again with any further ideas, questions, etc. Glad to help anytime.

    Thread Starter Md. Redwan Hossain

    (@redwancou)

    I have also 2 feature request.
    Per ip/User form submit limit.
    Ability to disable blank form submit.

    I think these two option will greatly reduce spam attack.

    Plugin Author Jeff Starr

    (@specialk)

    Thanks.

    “I think these two option will greatly reduce spam attack.”

    That’s what the Google reCaptcha is for, very effective at stopping spam.

    “Per ip/User form submit limit.”

    Interesting idea, will add to the list.

    “Ability to disable blank form submit.”

    Just make any field required, will prevent all blank form submissions.

    Thread Starter Md. Redwan Hossain

    (@redwancou)

    I got this feature idea from fluent form plugin. It blocks submission after x number of try.

    Plugin Author Jeff Starr

    (@specialk)

    Okay thanks, will consider it.

Viewing 8 replies - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.