MailHost overrides explicitly set 'From' header in the message text.

Bug #965178 reported by Taras Melnychuk
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Zope 2
Invalid
Low
Unassigned

Bug Description

Zope MailHost overrides explicitly set 'From' header in the message text.

Revision history for this message
Taras Melnychuk (melnychuktaras) wrote :
summary: - MailHost overrides explicitly set 'From' header in the messageText
+ MailHost overrides explicitly set 'From' header in the message text.
Revision history for this message
Myroslav Opyr (myroslav) wrote :

The attached patch is not perfect as it breaks testSendMessageObject() in line 447. See http://zope3.pov.lt/trac/browser/Products.MailHost/trunk/src/Products/MailHost/tests/testMailHost.py?rev=116940#L447.

Unfortunately MailHost.send utilizes _mungeHeaders that has following annotation regarding the From header mungling:
# XXX: do we really want to override an explicitly set From

I.e. at the moment there is no way to setup SMTP envelope different from message headers.

Should we offer extra keyword argument to send(), or completely alternative send2() that will offer the functionality.

If patch applied AS IS it can break some code that relied on rewritten header.

Note that the patch will add From header in the case e-mail missed it. But it won't overwrite one that there already was. This is the case that the patch is aiming to: Ability to have different e-mails in envelope and in email headers.

Revision history for this message
Alec Mitchell (alecm) wrote :

My recollection is that the prior implementation of MailHost.send overrode the header, and so I preserved that behavior despite some reservations about it (hence the XXX). This patch is simple enough, adds a useful feature and is unlikely to trigger any errors. If the tests are updated as well, then it should be fine to commit it.

It seems like the worst case scenario would be one where a message template with a generic From header was included, and where the application intended the from passed into send() to override that generic header in addition to being used for the envelope. That would result in a message with an unexpected from address, but should probably not cause any delivery problems or other serious errors.

Revision history for this message
Myroslav Opyr (myroslav) wrote : Re: [Bug 965178] Re: MailHost overrides explicitly set 'From' header in the message text.

The change can potentially break some Gmail (or other MUA) filters that
relied on From header to be overwritten by send(). We'll update the patch
with version that has test corrected to take the changed behavior into
account. We'll possibly extend the dummy object to record envelope records
and will test if these envelope records are still correct.

On Tue, Mar 27, 2012 at 18:12, Alec Mitchell <email address hidden>wrote:

> My recollection is that the prior implementation of MailHost.send
> overrode the header, and so I preserved that behavior despite some
> reservations about it (hence the XXX). This patch is simple enough,
> adds a useful feature and is unlikely to trigger any errors. If the
> tests are updated as well, then it should be fine to commit it.
>
> It seems like the worst case scenario would be one where a message
> template with a generic From header was included, and where the
> application intended the from passed into send() to override that
> generic header in addition to being used for the envelope. That would
> result in a message with an unexpected from address, but should probably
> not cause any delivery problems or other serious errors.
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/965178
>
> Title:
> MailHost overrides explicitly set 'From' header in the message text.
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/zope2/+bug/965178/+subscriptions
>

--
.....................................................................................................
Myroslav Opyr ▪ CTO ▪ Quintagroup ▪ http://quintagroup.com
˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙

Revision history for this message
Taras Melnychuk (melnychuktaras) wrote :

Here is a new patch with fixed 'testSendMessageObject()' test. Also I added the test that ensures that 'From' header in the message and 'MAIL FROM' SMTP Envelope header can be different. The test also checks that 'MAIL FROM' SMTP Envelope header value was set into message if 'From' header was missed.

Revision history for this message
Hanno Schlichting (hannosch) wrote :

Sounds like Alec would love to review and commit the final patch ;)

Changed in zope2:
importance: Undecided → Low
status: New → Confirmed
Revision history for this message
Taras Melnychuk (melnychuktaras) wrote :

Hi guys,

is there any progress on this issue? Let me know if my patch should be corrected or rewritten. Thanks!

Revision history for this message
Colin Watson (cjwatson) wrote :

The zope2 project on Launchpad has been archived at the request of the Zope developers (see https://answers.launchpad.net/launchpad/+question/683589 and https://answers.launchpad.net/launchpad/+question/685285). If this bug is still relevant, please refile it at https://github.com/zopefoundation/zope2.

Changed in zope2:
status: Confirmed → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.