Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Each email that is generated by the shop web application is returning: Delivery status notification, invalid header: bad MIME

From looking at the error message it look like it is complaining about the HTML that is in the email although when viewing the source there doesn't look like a problem.

Your message WAS SUCCESSFULLY RELAYED to:
  <tim@example.com>

This delivery report was generated by the program amavisd-new at host
example.com. Our internal reference code for your message is
20971-09/NNjaWqvFY5Qg

INVALID HEADER: BAD MIME HEADER SECTION OR BAD MIME STRUCTURE

  MIME error: error: couldn't parse head; error near:; Return ID: 1; Return
    Date: 11/09/2011

Return-Path: <tim@example.com>
From: =?UTF-8?B?WW91ciBTdG9yZQ==?=<tim@example.com>
Message-ID: <20110911175440.A84BE5E099@example.com>
X-Mailer: PHP/5.3.4
Subject: =?UTF-8?B?WW91ciBTdG9yZSAtIFJldHVybiBVcGRhdGUgMQ==?=



dsn_status

Reporting-MTA: dns; example.com
Received-From-MTA: smtp; example.com ([127.0.0.1])
Arrival-Date: Sun, 11 Sep 2011 18:54:40 +0100 (BST)

Original-Recipient: rfc822;tim@example.com
Final-Recipient: rfc822;tim@example.com
Action: delayed
Status: 2.0.0
Diagnostic-Code: smtp; 250 2.6.0 Bad message, but will be delivered anyway
Last-Attempt-Date: Sun, 11 Sep 2011 18:54:40 +0100 (BST)
Final-Log-ID: 20971-09/NNjaWqvFY5Qg


header

Return-Path: <tim@example.com>
Received: from example.com (cpc10-donc9-2-0-cust122.barn.cable.virginmedia.com [94.171.174.123])
    by example.com (iRedMail) with ESMTPSA id A84BE5E099
    for <tim@example.com>; Sun, 11 Sep 2011 18:54:40 +0100 (BST)
To: tim@example.com
Subject: =?UTF-8?B?WW91ciBTdG9yZSAtIFJldHVybiBVcGRhdGUgMQ==?=
X-PHP-Originating-Script: 0:mail.php
MIME-Version: 1.0
Date: Sun, 11 Sep 2011 17:54:40 +0000
From: =?UTF-8?B?WW91ciBTdG9yZQ==?=<tim@example.com>
Reply-To: Your Store<tim@example.com>
X-Mailer: PHP/5.3.4
Content-Type: multipart/related; boundary="----=_NextPart_b45f3c386576f1955bb5338634f5047f"
Message-Id: <20110911175440.A84BE5E099@example.com>

Email Message source that causes the above error:

Return-Path: <tim@example.com>
Delivered-To: tim@example.com
Received: from localhost (localhost.localdomain [127.0.0.1])
    by example.com (iRedMail) with ESMTP id 4C03E5E09C
    for <tim@example.com>; Sun, 11 Sep 2011 18:54:41 +0100 (BST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=example.com;
     h=message-id:content-type:content-type:x-mailer:reply-to:from
    :from:date:date:mime-version:subject:subject:to; s=dkim; t=
    1315763680; x=1316627680; bh=18GKmsQjF86uG/PbhhDg2FY9o3H6chH8XZo
    4VFFN45k=; b=g4TbDzU8pWzeX7CdmCI/Sq8JjtPM6wTQIMqQ7dRclE0XqCVgEZ4
    OeQtpR1zApiV31RLu87k9QQF6a4mvCmr1N31auiq4u+AfxFW3DujSvDz5h3lSSf4
    vPVgHwzEBQbaue9VeZ0nPmHhrrJWojv5iMlfjUKIdNJkBuP9BF3plVgA=
X-Quarantine-ID: <NNjaWqvFY5Qg>
X-Amavis-Modified: Mail body modified (using disclaimer) -
    example.com
X-Virus-Scanned: by amavisd at example.com
X-Amavis-Alert: BAD HEADER SECTION, MIME error: error: couldn't parse head;
    error near:; Return ID: 1; Return Date: 11/09/2011
X-Spam-Flag: NO
X-Spam-Score: -6.697
X-Spam-Level: 
X-Spam-Status: No, score=-6.697 tagged_above=-999 required=6.31
    tests=[ALL_TRUSTED=-10, AWL=-1.381, FROM_EXCESS_BASE64=1.984,
    HTML_MESSAGE=0.001, MISSING_MIME_HB_SEP=2.699] autolearn=disabled
Received: from example.com ([127.0.0.1])
    by localhost (example.com [127.0.0.1]) (amavisd-new, port 10024)
    with ESMTP id NNjaWqvFY5Qg for <tim@example.com>;
    Sun, 11 Sep 2011 18:54:40 +0100 (BST)
Received: from example.com (cpc10-donc9-2-0-cust122.barn.cable.virginmedia.com [94.171.174.123])
    by example.com (iRedMail) with ESMTPSA id A84BE5E099
    for <tim@example.com>; Sun, 11 Sep 2011 18:54:40 +0100 (BST)
To: tim@example.com
Subject: =?UTF-8?B?WW91ciBTdG9yZSAtIFJldHVybiBVcGRhdGUgMQ==?=
X-PHP-Originating-Script: 0:mail.php
MIME-Version: 1.0
Date: Sun, 11 Sep 2011 17:54:40 +0000
From: =?UTF-8?B?WW91ciBTdG9yZQ==?=<tim@example.com>
Reply-To: Your Store<tim@example.com>
X-Mailer: PHP/5.3.4
Content-Type: multipart/related; boundary="----=_NextPart_b45f3c386576f1955bb5338634f5047f"
Message-Id: <20110911175440.A84BE5E099@example.com>

------=_NextPart_b45f3c386576f1955bb5338634f5047f
Content-Type: multipart/alternative; boundary="----=_NextPart_b45f3c386576f1955bb5338634f5047f_alt"

------=_NextPart_b45f3c386576f1955bb5338634f5047f_alt
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Return ID: 1
Return Date: 11/09/2011

Your return has been updated to the following status:
Complete

The comments for your return are:

gsfdgf


g
fdgfdgfdgfd

Please reply to this email if you have any questions.

------=_NextPart_b45f3c386576f1955bb5338634f5047f_alt
Content-Type: text/html; charset="utf-8"
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Your Store</title>
    <style type="text/css">
        v\:* {
            behavior: url(#default#VML);
            display:inline-block;
        }
    </style>

</head>
<body bgcolor="#f5f5f5" style="margin:0; padding:0; background-color:#f5f5f5; color:#333333; font-size:12px; font-family:Helvetica, Arial, sans-serif; line-height:18px; width:100% !important;">

<table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
        <td align="center">             
            <table width="660" border="0" cellspacing="0" cellpadding="0">
                    <td id="main-bg" align="center" valign="middle" background="http://www.example.com/default/image/mail/body-repeat-white.gif" style="margin:0 auto; background-image:url('http://www.example.com/default/image/mail/body-repeat-white.gif'); background-repeat:repeat-y; width:660px; postion:relative;">
                        <!--[if gte mso 9]>
                        <v:background xmlns:v="urn:schemas-microsoft-com:vml">
                                   <v:fill type="solid" src="http://www.example.com/default/image/mail/body-repeat-white.gif" />
                        </v:background>
                        <![endif]-->
                        <table width="580" border="0" cellspacing="0" cellpadding="0" style="overflow:hidden; table-layout:fixed; width:580px; word-wrap:break-word;">
                            <tr>
                                <td id="header-bg" bgcolor="#515151" background="http://www.example.com/default/image/mail/head-bg.jpg" style="background-image:url("http://www.example.com/default/image/mail/head-bg.jpg"); background-repeat:no-repeat; background-color:#434343; font-size:30px; color:#ffffff;">
                                    <table border="0" cellspacing="0" cellpadding="20">
                                    <tr>
                                        <td>
                                        <a href="http://localhost/opencart-1.5/" title="Your Store" style="display:block;padding-left:10px;">
                                            <img src="http://localhost/opencart-1.5/image/data/logo.png" alt="Your Store" style="display:block; border:none;" />
                                        </a>
                                        </td>
                                    </tr>
                                    </table>
                                </td>
                            </tr>
                            <tr>
                                <td bgcolor="#ffffff" style="background-color:#ffffff; padding:5px 25px 0; font-size:12px; font-family:Helvetica, Arial, sans-serif; line-height:18px;text-align:left;">
                                    <h1 style="color:#333333; font-size:18px; font-weight:bold; line-height:28px; margin:10px 0;">Your Store</h1>

                                    <p>
                                        <strong>Return ID:</strong> 1<br />
                                        <strong>Return Date:</strong> 11/09/2011                                    </p>

                                    <p>Your return has been updated to the following status: <strong>Complete</strong></p>

                                    <p><strong>The comments for your return are:</strong>gsfdgf<br /><br /><br />g<br />fdgfdgfdgfd</p>                                 
                                    <p>Please reply to this email if you have any questions.</p>
                               </td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </table>
      </td>
   </tr>

</table>

<style type="text/css">
      p {
        font-size:12px;
        font-family:Helvetica, Arial, sans-serif;
        line-height:18px;
        margin:4px 0 12px;
      }
      strong {
        font-weight:bold;         
      }
      a {
        color:#28b0ec;
        text-decoration:none;
        border:none;         
      }
      a:hover {
        color:#28b0ec;
        text-decoration:underline;
        cursor:pointer;         
      }
      a:visited {
        text-decoration:underline;
      } 
    </style>
</body>
</html>
------=_NextPart_b45f3c386576f1955bb5338634f5047f_alt--
------=_NextPart_b45f3c386576f1955bb5338634f5047f--
share|improve this question

2 Answers 2

up vote 2 down vote accepted

There must be an empty line between the message or MIME headers and the message content:

------=_NextPart_b45f3c386576f1955bb5338634f5047f_alt
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Return ID: 1
Return Date: 11/09/2011

Here you'll need an empty line between Content-Transfer-Encoding: 8bit and Return ID: 1.

If Return ID and Return Date should be headers, they are syntactically wrong. Headers must not contain a whitespace in the header name. Valid headers would be Return-Id and Return-Date.

share|improve this answer
    
I think I get what you mean, although the return ID and date are part of the email body and shouldn't be added to the header. –  John Magnolia Sep 11 '11 at 18:52
    
It is the header. It's not the header of the mail, but it is the header of the Mime-Part. So this is why the error message states "MIME HEADER SECTION" and not "EMAIL HEADER". Joshi is totally correct here. And in the message you see that it complains about Return ID and Return Date. –  mailq Sep 11 '11 at 21:34

It looks like it may also be your MIME Content-Transfer-Encoding declaration of 8bit, whereas it looks like most text-type content is typically declared as 7bit.

Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: 7bit
share|improve this answer
    
This is something that is specified within the core mail class of Opencart. –  John Magnolia Sep 11 '11 at 18:54
    
    
Testing what has been pointed out should not be too challenging since you have access to the source. The code itself has very little to do as to what the receiving system/server is testing and expecting. –  user48838 Sep 11 '11 at 19:43

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.