News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

SMF sends notification mail with multiple MIME-Version headers

Started by pgf, March 04, 2015, 08:53:33 PM

Previous topic - Next topic

pgf

SMF sends notification mail with multiple MIME-Version headers.  Happily, they all match.   ;)

Multiple identical version headers is a pretty benign email violation of RFC 2045, as these things go, but believe it or not, it made my mailer complain.  (The mailer is nmh.  And yes, I've contributed a fix there.)

Here's (an excerpt of) an example offending message, which was sent by SMF 2.0.5:

Received: from [193.35.56.7] (port=53686 helo=aragon.oakleynode.co.uk)
        by aragon.oakleynode.co.uk with esmtpa (Exim 4.85)
        (envelope-from <[email protected]>)
        id 1YTKOY-00068i-9Z
        for [email protected]; Thu, 05 Mar 2015 01:16:10 +0000
Subject: Topic reply: why "sliding carriage"?
To: <[email protected]>
Mime-Version: 1.0
From: "Triumph Tiger 800 Forum" <[email protected]>
Date: Thu, 05 Mar 2015 01:15:52 -0000
Message-ID: <[email protected]> (sfid-20150304_202214_383492_4F04ECD8)
X-Mailer: SMF
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary="SMF-19bc0515780eb8b316b2d0c22bb70d25"
Content-Transfer-Encoding: 7bit
X-AntiAbuse: This header was added to track abuse, please include it with any abuse report
X-AntiAbuse: Primary Hostname - aragon.oakleynode.co.uk


There's another example here, in the sample email "greek original (with headers)":
http://www.simplemachines.org/community/index.php?topic=425397.msg2982599#msg2982599

I don't know what SMF version that is, but perhaps it appears elsewhere in that thread.

paul

Steve

I know little of what you speak but my first thought was 'does it do this in 2.0.9, the latest version?'.
DO NOT pm me for support!

pgf

Quote from: Steve on March 04, 2015, 09:02:46 PM
I know little of what you speak but my first thought was 'does it do this in 2.0.9, the latest version?'.

i couldn't say, since i think this site may be the only 2.0.9 site i've used, and i only registered this evening to report the problem.  but unless there's more config i need to do, if i don't look at this thread until well after you've replied again, then i should get a "topic reply", correct?  and then we'll perhaps see if it shows the problem.

you might be able to answer your question more quickly than i can though, by simply examining the email headers of mail you've received from the site?

pgf

well, i was hoping you, or someone else, was going to reply to my second message, thereby generating a notification email which i could examine.

but no one replied, and i see that this forum may not implement email notifications, since there's no "Turn notification on when you post or reply to a topic" checkbox under account settings.

so instead, i tried sending myself email from this forum (2.0.9) and the forum where i first noticed the problem (2.0.5).  the latter sent mail with multiple MIME-Version headers.  this forum did not.

i can't say that that means the problem doesn't exist in 2.0.9, but it didn't exist for that specific email.

Steve

Actually, there is a "Turn notification on when you post or reply to a topic" checkbox, it just may not show until you've reached a certain number of posts.

And sorry about not replying. I was hoping one of the experts would respond and I forgot to check this thread.
DO NOT pm me for support!

Illori

Quote from: Steve on March 04, 2015, 09:02:46 PM
I know little of what you speak but my first thought was 'does it do this in 2.0.9, the latest version?'.

either way the op should upgrade to 2.0.9 for security fixes, 2.0.5 is insecure and will not work with php 5.5.

full access to your profile including adding a signature is available at 10 posts... in the mean time you can always click the notify link at the bottom and top of this topic.

margarett

On another note: IIRC there were no changes in SMF from 2.0.5+ that would affect email headers. Yes, you should update to 2.0.9 but I don't think it will fix it for you :(

I guess that it should be server related? Maybe you can try some mail script to check out of SMF? Like those suggested here:
http://www.simplemachines.org/community/index.php?topic=534062.msg3796997#msg3796997
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

pgf

thanks all.  to be clear, on the other site i am just a user, not an owner or admin, so it's not up to me to do an upgrade.  (site is hxxp:www.tiger800.co.uk [nonactive], btw.)

the issue is definitely not server related, unless it's at a server at the forum hosting site.  the mail goes directly from there to a server in my cellar (yes, no ISP involved), and i know my own server isn't adding that header.

if there have been no changes to email generation between 2.0.5 and 2.0.9, then perhaps it's affected by user or site configuration.

if this were really a bug tracking system, i'd mark it as low priority.

Illori

then maybe you need to contact the admin of that forum so they can look into the issue or ask their host to look into it.

Arantor

This has been reported before but we could not determine the root cause of it, or indeed if it wasn't modified at some point.

pgf

Quote from: Arantor on March 05, 2015, 04:33:17 PM
This has been reported before but we could not determine the root cause of it, or indeed if it wasn't modified at some point.

here's a more complete set of headers.  if the message is being modified after being generated, it's happening while still at the hosting site -- we can tell because both Mime-Version headers are included in the DKIM header.  don't know if this helps, but at least it's more data.  it certainly seems unlikely that you'd generate a Mime-Version header in between To: and From:, but you'd know that better than i would.

paul


Return-Path: <[email protected]>
X-Original-To: [email protected]
Delivered-To: [email protected]
Received: from colo.foxharp.net (grass [127.0.0.1])
        by grass.foxharp.boston.ma.us (Postfix) with ESMTP id 465EF51823B6
        for <[email protected]>; Thu,  5 Mar 2015 15:42:15 -0500 (EST)
Received: from aragon.oakleynode.co.uk (aragon.oakleynode.co.uk [193.35.56.6])
        by colo.foxharp.net (Postfix) with ESMTPS id 4510940F5B
        for <[email protected]>; Thu,  5 Mar 2015 15:42:15 -0500 (EST)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tiger800.co.uk; s=default;
        h=Content-Transfer-Encoding:Content-Type:Mime-Version:Message-ID:Date:From:Mime-Version:To:Subject; bh=Y1m4X6oEccC6evE0ZE7hwugWv5E+9ykq6MzxN7KDuMM=;
        b=F4f0GSsgyxsvr5/e2rphXdUCEai6XqM2qep5IMFe8G+3Anwuq7c2bb/lbcjKpymnyj2MlLQSmvZf+7EWc20phwYyLhw8MXfT3TOD7JWKI+nx3WkiNeEc2agiw/+U+DZxVBe3UYPvpxzCIEYNTuPKVSLrh12YT8INoNSchIlztU4=;
Received: from [193.35.56.7] (port=36684 helo=aragon.oakleynode.co.uk)
        by aragon.oakleynode.co.uk with esmtpa (Exim 4.85)
        (envelope-from <[email protected]>)
        id 1YTcV9-0007Mq-Gw
        for [email protected]; Thu, 05 Mar 2015 20:36:11 +0000
Subject: Topic reply: why "sliding carriage"?
To: <[email protected]>
Mime-Version: 1.0
From: "Triumph Tiger 800 Forum" <[email protected]>
Date: Thu, 05 Mar 2015 20:35:56 -0000
Message-ID: <[email protected]> (sfid-20150305_154215_408945_285178ED)
X-Mailer: SMF
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary="SMF-00677cd08f83c912e350f2ad590b919d"
Content-Transfer-Encoding: 7bit
X-AntiAbuse: This header was added to track abuse, please include it with any abuse report
X-AntiAbuse: Primary Hostname - aragon.oakleynode.co.uk
X-AntiAbuse: Original Domain - foxharp.boston.ma.us
X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12]
X-AntiAbuse: Sender Address Domain - tiger800.co.uk
X-Get-Message-Sender-Via: aragon.oakleynode.co.uk: authenticated_id: [email protected]
X-Source:
X-Source-Args:
X-Source-Dir:
X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3
X-CRM114-CacheID: sfid-20150305_154215_408945_285178ED
X-CRM114-Status: GOOD (  13.45  )

WadaNon

I had this issue in the past and is related to the mail queue.

On line 1005 in ScheduledTasks.php there's this line:

$result = smtp_mail(array($email['to']), $email['subject'], $email['body'], $email['send_html'] ? $email['headers'] : 'Mime-Version: 1.0' . "\r\n" . $email['headers']);

From what I got when debugging this, the headers (including the Mime-Version header) are saved to the mail queue and when sending the messages from the queue, the code that decides that a message is getting sent as HTML or not gets it wrong (dunno why, I use Mandrill for sending mails now) and adds the extra Mime-Version header. A dirty fix is to replace that line with this:

$result = smtp_mail(array($email['to']), $email['subject'], $email['body'], $email['headers']);

But a proper fix would be why $email['send_html'] returns true every time if it should be false most of the time and fix that.

Edit: It probably happens too in SMF 2.1.
No to support PMs and spam, yes to everything else :D

fearthe1337

Quote from: WadaNon on April 07, 2015, 01:38:27 AM
I had this issue in the past and is related to the mail queue.

On line 1005 in ScheduledTasks.php there's this line:

$result = smtp_mail(array($email['to']), $email['subject'], $email['body'], $email['send_html'] ? $email['headers'] : 'Mime-Version: 1.0' . "\r\n" . $email['headers']);

From what I got when debugging this, the headers (including the Mime-Version header) are saved to the mail queue and when sending the messages from the queue, the code that decides that a message is getting sent as HTML or not gets it wrong (dunno why, I use Mandrill for sending mails now) and adds the extra Mime-Version header. A dirty fix is to replace that line with this:

$result = smtp_mail(array($email['to']), $email['subject'], $email['body'], $email['headers']);

But a proper fix would be why $email['send_html'] returns true every time if it should be false most of the time and fix that.

Edit: hxxp:github.com/SimpleMachines/SMF2.1/blob/release-2.1/Sources/ScheduledTasks.php#L947 [nonactive]

As far as I can see all emails send to that function already have the mine-version header set. I would say the best fix is to remove it from this function.

Edit: You are reading the code wrong :)

$email['send_html'] ? $email['headers'] : 'Mime-Version: 1.0' . "\r\n" . $email['headers']

Means it uses the headers given to it, if the email is marked as html.
If the email is NOT html, it adds the Mime-Version.

However as a lot of the emails are encoded in 2 different ways, it already has a mine-version header.

Edit2:
Submitted a PullRequest: hxxp:github.com/SimpleMachines/SMF2.1/pull/2884 [nonactive]
and an Issue report: hxxp:github.com/SimpleMachines/SMF2.1/issues/2883 [nonactive]




Advertisement: