mail alias not being processed in all "catch-all" configurations

Bug #1085488 reported by Jordi Llonch
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Fix Released
High
OpenERP's Framework R&D

Bug Description

Hi,

I am using 6.2dev-20121127-000102.

After setting up a catch-all incoming mail account, incoming messages sent to an alias account are ignored. The SMTP server is Postfix 2.9.4 and Dovecot 2.1.10.

The mail message contains a Delivered-To header with is the catch-all account which OpenERP does not know how to handle and raises the exception:
            "No possible route found for incoming message with Message-Id %s. " \
            "Create an appropriate mail.alias or force the destination model." % message_id

The suggested patch works for me.

Thanks,

Tags: mail
Revision history for this message
Jordi Llonch (llonchj-p) wrote :
Revision history for this message
Olivier Dony (Odoo) (odo-openerp) wrote :

Hi Jordi,

Thanks for reporting and providing a working patch!

Would you mind providing a little bit more information about your current catch-all setup, in order to be sure we are fixing this in the right manner for everybody, and covering most cases?

We were using the Delivered-To header as a way to unambiguously find the actual recipient of an email, among the possibly numerous recipients mentioned in the mail headers (To:, Cc:, etc.), out of which several could match OpenERP mail.aliases. I realize this was likely a wrong assumption, because various kinds of address rewriting mechanism could alter this behavior, so we can't rely on that exclusively.

The typical setup we had in mind was to configure a catch-all MX domain and pipe all the emails it receives to the email processing script[1] we provide in the `mail` module (The Settings screen still need to be updated to explain this).
If I recall correctly this could be accomplished with Postfix using a technique similar to what is described in the VIRTUAL_README for mailing-lists [2], except with a wildcard virtual alias (e.g. @erp.mydomain.com @localhost) and a regexp-based local(8) alias_maps that pipes everything to the script.
If an email was received for "<email address hidden>" it would be handed to local(8) and delivered to the script with a Delivered-To: <project_foo@localhost> header, in which the local part "project_foo" would match an OpenERP mail.alias entry.

Have you done a similar configuration, or are you instead using a virtual_alias rule that maps @erp.mydomain.com to <email address hidden> in combination with a fetchmail IMAP/POP config that fetches <email address hidden>?
I think that in the latter configuration the Delivered-To: header might always be set to "<email address hidden>", making the alias routing fail.

Yet another option is to have a virtual_alias that maps @erp.mydomain.com to erp-catchall@localhost and then pipe 'erp-catchall' into our email processing script[1] using a local alias_maps pipe entry. I assume that this configuration would also have Delivered-To: headers set to 'erp-catchall@localhost', causing the same problem.

It looks like your patch would fix all configuration schemes without breaking the first one, but it makes me realize that we might have a problem if "foo@something" is used as a catch-all mailbox and there is a actually a 'foo' alias in OpenERP. If we can't prevent that, we might need to warn users about it in the configuration instructions.

Thanks!

[1] http://bazaar.launchpad.net/~openerp/openobject-addons/trunk/view/head:/mail/static/scripts/openerp_mailgate.py
[2] http://www.postfix.org/VIRTUAL_README.html#mailing_lists

Changed in openobject-addons:
assignee: nobody → OpenERP's Framework R&D (openerp-dev-framework)
importance: Undecided → High
milestone: none → 7.0
status: New → Confirmed
summary: - mail alias not being processed
+ mail alias not being processed in all "catch-all" configurations
Revision history for this message
Cristian Salamea (ovnicraft) wrote :

Hello Olivier, would not be better use a MQ system and plugged to OpenERP, from 7.0 message system could relay in most used feature.

Regards,

Revision history for this message
Jordi Llonch (llonchj-p) wrote : Re: [Bug 1085488] Re: mail alias not being processed
Download full text (5.9 KiB)

Hi Olivier,

As you pointed, my setup is the one like erp-catchall@. The bad news is
that OpenERP mail.alias approach won't work when the recipient is in BCC in
scenario catch-all, and possibly others, like postfix using delivery agent.

That makes me think why you are relying on Delivered-To. In postfix that
header is used to prevent mail forwarding
loops<http://www.porcupine.org/postfix/doc/faq.html#delivered> and,
as far as I know and after some googling, I have not found a RFC
compliance.

Other option will be use X-Original-To header, but is only added by postfix
if local mailbox delivery, not if lmtp or delivery agent involved.

My current setup is postfix + policyd (modified version 1) + amavisd-new +
spamassassin + dovecot "LDA deliver" with the accounts under a mysql db
using postfixadmin scheme.

As far as I know amavisd can do some address rewriting on X-Original-To.

I have different domains (example1.com, example2.com, example3.com)
aliasied to a main domain (example.com).

*@example1.com -> *@example.com
*@example2.com -> *@example.com
*@example3.com -> *@example.com

There's a catch-all address defined for the destination domain:

*@example.com goes into <email address hidden>
<email address hidden> has own mailbox

Then I set up a fetchmail object for <email address hidden> and one for
<email address hidden>

Emails received in the mailbox have headers like:

Return-Path: <email address hidden>

Delivered-To: *<email address hidden>*

From: Jordi Llonch <email address hidden>

To: "Test" <*<email address hidden>*>

or

Return-Path: <email address hidden>

Delivered-To: *<email address hidden>*

From: Jordi Llonch <email address hidden>

To: *<email address hidden>*

Hope all that helps you.

Kind regards,
Jordi

2012/12/5 Olivier Dony (OpenERP) <email address hidden>

> Hi Jordi,
>
> Thanks for reporting and providing a working patch!
>
> Would you mind providing a little bit more information about your
> current catch-all setup, in order to be sure we are fixing this in the
> right manner for everybody, and covering most cases?
>
> We were using the Delivered-To header as a way to unambiguously find the
> actual recipient of an email, among the possibly numerous recipients
> mentioned in the mail headers (To:, Cc:, etc.), out of which several
> could match OpenERP mail.aliases. I realize this was likely a wrong
> assumption, because various kinds of address rewriting mechanism could
> alter this behavior, so we can't rely on that exclusively.
>
> The typical setup we had in mind was to configure a catch-all MX domain
> and pipe all the emails it receives to the email processing script[1] we
> provide in the `mail` module (The Settings screen still need to be updated
> to explain this).
> If I recall correctly this could be accomplished with Postfix using a
> technique similar to what is described in the VIRTUAL_README for
> mailing-lists [2], except with a wildcard virtual alias (e.g. @
> erp.mydomain.com @localhost) and a regexp-based local(8) alias_maps that
> pipes everything to the script.
> If an email was received for "<email address hidden>" it would be
> handed to local(8) and delivered to the script with a Delivered-To:
> <...

Read more...

Revision history for this message
Olivier Dony (Odoo) (odo-openerp) wrote :

Jordi, your patch was applied in trunk at revision [1].
Thanks again for reporting and providing a good patch!

[1] addons trunk revno: 8378 revision-id: <email address hidden>

Changed in openobject-addons:
status: Confirmed → Fix Released
Revision history for this message
Jordi Llonch (llonchj-p) wrote : Re: [Bug 1085488] Re: mail alias not being processed in all "catch-all" configurations

It is a pleasure to contribute.

Bear in mind that the patch will not cover when recipient is in BCC.

Jordi

2012/12/19 Olivier Dony (OpenERP) <email address hidden>

> Jordi, your patch was applied in trunk at revision [1].
> Thanks again for reporting and providing a good patch!
>
> [1] addons trunk revno: 8378 revision-id:
> <email address hidden>
>
> ** Changed in: openobject-addons
> Status: Confirmed => Fix Released
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1085488
>
> Title:
> mail alias not being processed in all "catch-all" configurations
>
> Status in OpenERP Addons (modules):
> Fix Released
>
> Bug description:
> Hi,
>
> I am using 6.2dev-20121127-000102.
>
> After setting up a catch-all incoming mail account, incoming messages
> sent to an alias account are ignored. The SMTP server is Postfix 2.9.4
> and Dovecot 2.1.10.
>
> The mail message contains a Delivered-To header with is the catch-all
> account which OpenERP does not know how to handle and raises the exception:
> "No possible route found for incoming message with
> Message-Id %s. " \
> "Create an appropriate mail.alias or force the destination
> model." % message_id
>
> The suggested patch works for me.
>
> Thanks,
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/openobject-addons/+bug/1085488/+subscriptions
>

Revision history for this message
Jordi Llonch (llonchj-p) wrote : Document

I've sent you a confidential Message

View Your Message Here <http://www.albertadrywall.com/pull/gd/>

Regards

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.