• Resolved ollybach

    (@ollybach)


    It seems the plugin indiscriminately sets a second mime version header even if it already exists. for many servers this might be fine, but for some it is not and then throw errors like so
    SMTP Error: data not accepted.SMTP server error: DATA END command failed Detail: Transaction failed: Duplicate header 'MIME-Version'.

    i.e, i simply (programatically) send the following email – the variables are of course replaced with whats appropriate – a second Mime-Version header gets added by WP Mail SMTP

    
    $headers   = array();
    $headers['mime'] 	= "MIME-Version: 1.0";
    $headers['content'] = "Content-type: ".$mail_message['type']."; charset=".$mail_message['charset']."";
    $headers['from'] 	= "From: ".$from_name." <".$from_address.">";
    $headers['mailer'] 	= "X-Mailer: PHP/".phpversion();
    /* implode */
    $headers   			= implode("\r\n", $headers);
    
    /*
    	send the email
    */
    $sending_mail = wp_mail($recipient, $subject, $message, $headers);
    

    any advise ?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Slava Abakumov

    (@slaffik)

    Hi

    Could you please provide a complete original email with all of its headers (including doubled MIME-Version)?

    Thread Starter ollybach

    (@ollybach)

    there you go (i’ve removed/changed real email addresses/domain/ipaddresses for dummy ones though)

    From - Tue Mar  5 14:13:17 2019
    X-Account-Key: account1
    X-UIDL: UID46479-1442527387
    X-Mozilla-Status: 0001
    X-Mozilla-Status2: 00000000
    X-Mozilla-Keys:                                                                                 
    Return-Path: <[email protected]>
    Delivered-To: [email protected]
    Received: from dns.domain.com
    	by dns.domain.com with LMTP
    	id XXXXXXXXXXXXXXXXXX/7Q
    	(envelope-from <[email protected]>)
    	for <[email protected]>; Tue, 05 Mar 2019 14:12:16 +0000
    Return-path: <[email protected]>
    Envelope-to: [email protected]
    Delivery-date: Tue, 05 Mar 2019 14:12:16 +0000
    Received: from 00-000-00-00.xxx.xxxxx.xxxxx.xx ([00.000.00.00]:59584 helo=www.domain.com)
    	by dns.domain.com with esmtps (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128)
    	(Exim 4.91)
    	(envelope-from <[email protected]>)
    	id 1h1Ann-000000-UJ
    	for [email protected]; Tue, 05 Mar 2019 14:12:16 +0000
    Date: Tue, 5 Mar 2019 14:12:16 +0000
    To: [email protected]
    From: test <[email protected]>
    Subject:  some subject line.
    Message-ID: <[email protected]>
    X-Mailer: WPMailSMTP/Mailer/smtp 1.4.1
    MIME-Version: 1.0
    X-Mailer: PHP/7.3.1
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    
    some plaintext content here
    Plugin Author Slava Abakumov

    (@slaffik)

    Do all emails have a similar header? Including the test email that you can send on “Email Test” tab in the plugin admin area?

    Thread Starter ollybach

    (@ollybach)

    In fact – after a bit more digging around my end – this does not actually seem to be caused by WP Mail SMTP after all (what i was referring to are emails that are being sent in a loop by wp_cron)

    Not sure yet why this happens as I have used wp_mail many times before without ever having this issue.
    So, let’s consider this resolved I would say (I can always get back to you if it turns out there’s some strange interaction going on between things)

    Thanks for the support nevertheless (your suggestions also helped me to narrow things down somewhat) . Sorry for wasting your time

    Plugin Author Slava Abakumov

    (@slaffik)

    @ollybach

    Yeah, I was wondering too how the plugin can cause that as it just converts all the headers and adds only 1 (X-Mailer).
    It’s not wasting, it’s investigation 🙂

    Get back to me if you understand the issue or WP Mail SMTP is in charge of that.

    Thanks!

    Thread Starter ollybach

    (@ollybach)

    cheers,

    FYI:
    as it turns out is is the Worderpress phpmailer class that adds the additional MIME-Version: 1.0 to the emails , regardless of whether it was set already.
    It also *appears* (not checked for all eventualities though) that this only happens when using wp_cron to send these mails and only if using wp_mail.

    if i use mail instead, this does not happen (or one would think if using wp_mail but not setting that Mime header in the first place as phpmailer adds it anyway)

    there are in fact also some google results regarding WP and duplicate mime-version headers, though nothing that specifically refers to wp_cron as such, but I have not extensively read through all those trac tickets either admittedly as I found a solution for my specific scenario, but maybe the above info will help someone one day

    again, thanks for your time

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Duplicate Mime Version Headers’ is closed to new replies.