Support » Plugin: WP Mail SMTP by WPForms » Sending via Amazon SMTP Error: Duplicate header ‘MIME-Version’

  • Resolved codingdude

    (@codingdude)


    Hi,

    I have setup WP Mail SMTP to work with an Amazon AWS SMTP server. Sending test emails works.

    I have installed the User Verification plugin (https://wordpress.org/plugins/user-verification/) that should send a confirmation email when a user registers.

    But, when the user registers I get the following error:

    SMTP Error: data not accepted.SMTP server error: DATA END command failed Detail: Transaction failed: Duplicate header ‘MIME-Version’.
    SMTP code: 554

    I’m not sure when the MIME-Version header is set twice. I tried commenting out the line in that sets the MIME-Version header in the User Verification plugin, but it didn’t make any difference. Here’s how the headers look like

    [MIMEHeader:protected] => Date: Sat, 13 Jul 2019 07:54:48 +0000
    To: my@email.com
    From: Admin <admin@mysite.com>
    Subject: New User Submitted – http://www.mysite.com
    Message-ID: <813f9c492967e4a76ca8ddd332585eb8@www.mysite.com>
    X-Mailer: WPMailSMTP/Mailer/smtp 1.5.1
    MIME-Version: 1.0
    MIME-Version: 1.0
    Content-Type: text/html; charset=ISO-8859-1

    Any idea why this happens?

    thanks,
    John

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Support Sanjeev Aryal

    (@sanzeeb3)

    Hi John,

    Thanks for reporting the issue. This seems to be a bug within the plugin and I’ve passed this issue to our development team and we will be investigating soon.

    Have a good one!

    Can you provide an update on this issue?

    To my understanding WP Mail SMTP is supposed to overwrite/correct the headers. I have other plugins that create duplicate MIME-Version headers and AWS SES is refusing to send these as well.

    • This reply was modified 3 months, 2 weeks ago by breeakpoint.

    I have fixed the issue with the following code in my function.php

    
    /*
      PHPMailer inserts the below custom headers so we must remove them as it creates
      duplicate issues with AWS SES. WP potential fix of issue will come with 5.3.
      https://core.trac.wordpress.org/ticket/43542
    */
    add_action('phpmailer_init', 'phpmailer_init_fix');
    function phpmailer_init_fix($mailer) {
        $headers = $mailer->getCustomHeaders();
        $mailer->clearCustomHeaders();
        foreach ($headers as $key => $header) {
            if ($key !== 'MIME-Version' && $key !== 'X-Mailer' ) {
                $mailer->addCustomHeader($key, $header);
            }
        }
    }
    
    Plugin Support Sanjeev Aryal

    (@sanzeeb3)

    Hi @breeakpoint,

    Glad to know you sorted this out! We are investigating the issue as the error occurs only on certain server configurations. Hopefully, this will get fixed soon.

    Have a good one! 🙂

    No worries, I did’nt mention it in my post but a comment in my code. It is an issue with core WordPress that should be fixed in v5.3 (but I have not confirmed if it was as I have not upgraded yet)

    Plugin Support Sanjeev Aryal

    (@sanzeeb3)

    Hi @breeakpoint,

    Thanks for the information. We are not aware of any issue with the WordPress core. Please let us know after confirmation.

    Thanks!

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