• R

    (@rreisdasilvagmailcom)


    Hi guys,

    I’ve using Woocommerce for a long time and really think is a great plugin!

    I need your help with something, though. I’m trying to configure WordPress emails to be sent with SMTP and I have installed WP-SMTP I can configure the necessary fields and send test emails with no problem. However, once emails are sent by SMTP, Woocommerce emails stop being sent. Do you know any compatibility issue of Woocommerce with SMTP? Are there specific configurations I should be aware to have Woocommerce emails work with SMTP?

    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • I don’t use a plugin for SMTP, I just put the following code in the functions.php of a child theme and WordPress/WooCommerce emails are all sent via SMTP:

    
    add_action( 'phpmailer_init', 'send_mail_via_SMTP' );
    function send_mail_via_SMTP($phpmailer) {
        $phpmailer->isSMTP();     
        $phpmailer->Host = 'your email host domain';
        // Force it to use Username and Password to authenticate
        $phpmailer->SMTPAuth = true;
        $phpmailer->Port = 465;
        $phpmailer->Username = '[email protected]';
        $phpmailer->Password = 'your password';
        // Additional settings…
        // Choose SSL or TLS, if necessary for your server
        $phpmailer->SMTPSecure = "ssl";
        $phpmailer->From = "[email protected]";
        $phpmailer->FromName = "Email From Name";
    }
    

    You’ll have to set the variables for your host, and if you don’t use SSL, change the port, of course.

    Thread Starter R

    (@rreisdasilvagmailcom)

    Hi linux4me2,

    Thanks for your reply. I tried your method directly on the functions.php but the issue is the same. I suspect it might be a problem with the server, but what it is strange is that it seems it is only happening with emails sent from Woocommerce. Other test emails are being sent. I exchanged a few emails with the guys from Siteground where I have my website and they agree that the configurations (host, email, port, etc) are ok, so they say is a Woocommerce issue.

    Any suggestion to try and isolate the problem are welcomed ?? In any case thanks for all your help!

    Cheers,
    R

    I’d make sure the “From” email address in WooCommerce -> Settings -> Emails -> Email Sender Options is set to an email address or forwarder on your domain. If it’s not, and your server is set up to use SPF, it might prevent your emails from being sent. That setting would probably override what you have in your SMTP settings and make the behavior of WooCommerce SMTP differ from the rest of your site, which would use the “from” you set in your SMTP settings.

    If you can get a look at the mail logs, you should be able to see what the problem is. I don’t know if Siteground uses it, but if you have cPanel, there is Email -> Track Delivery, which you can use to check failed mail.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Woocommerce+ SMTP’ is closed to new replies.