Search code examples
smtpodoomessagesendmailodoo-8

Odoo/OpenERP - send all mails from same adress


We have set up Odoo 8 as a multi-user helpdesk tool, which creates a new project issue for each incoming mail. Incoming and outgoing servers are configured correctly and system parameters are set to

mail.catchall.domain: company.tld
mail.catchall.alias: helpdesk
mail.bounce.alias: bounce

The problem now is that every time a user comments the mail thread to answer the original issue creator, a new mail is generated with header

FROM: [user]@company.tld
TO: [followers]
REPLY-TO: [email protected]

Which is totally fine but leads to a sending failure due to our SMTP configuration. To get around this we want to achieve that all outgoing E-Mails are sent from the same specified address, like [email protected], no matter which user response to the thread.

How do we achieve this?


Solution

  • I had specific issue when I was working on Odoo 8 and I found fix but its not recommended action from developer view, because changing odoo source code is not recommended and changes can be lost.

    So what I did was to change email from address to real email from address. Yes it's weird but that's how Odoo works. Odoo is always sending from one specific email address and changes email from to user email address, but if you will look at email carefully you will notice that real sender is always same.

    The fix is changing this line

    smtp_from = message['Return-Path']
    

    to this line

    smtp_from = tools.config.get('email_from')
    

    in openerp/addons/base/ir/ir_mail_server.py file.

    PS I don't like this solution.