{"action":"created","issue":{"url":"https://api.github.com/repos/odoo/odoo/issues/5864","labels_url":"https://api.github.com/repos/odoo/odoo/issues/5864/labels{/name}","comments_url":"https://api.github.com/repos/odoo/odoo/issues/5864/comments","events_url":"https://api.github.com/repos/odoo/odoo/issues/5864/events","html_url":"https://github.com/odoo/odoo/issues/5864","id":63299528,"number":5864,"title":"Notification email has external FROM address.","user":{"login":"yelizariev","id":186131,"avatar_url":"https://avatars.githubusercontent.com/u/186131?v=3","gravatar_id":"","url":"https://api.github.com/users/yelizariev","html_url":"https://github.com/yelizariev","followers_url":"https://api.github.com/users/yelizariev/followers","following_url":"https://api.github.com/users/yelizariev/following{/other_user}","gists_url":"https://api.github.com/users/yelizariev/gists{/gist_id}","starred_url":"https://api.github.com/users/yelizariev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yelizariev/subscriptions","organizations_url":"https://api.github.com/users/yelizariev/orgs","repos_url":"https://api.github.com/users/yelizariev/repos","events_url":"https://api.github.com/users/yelizariev/events{/privacy}","received_events_url":"https://api.github.com/users/yelizariev/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-03-20T20:15:59Z","updated_at":"2015-04-11T11:20:45Z","closed_at":null,"body":"**Mail server reject notification emails**\r\n\r\nImpacted versions:\r\n\r\n - 8.0. Not sure about master, but it seems that there are no changes about this issue at mail_mail.py file.\r\n\r\nSteps to reproduce:\r\n\r\n 1. set up outgoing mail server via https://pdd.yandex.ru/\r\n 2. set alias for admin: admin@DOMAIN, set email for admin, e.g. ADMIN@gmail.com\r\n 3. activate notification for new emails for admin user\r\n 5. sent external email (e.g. from USER@CUSTOMER) to admin@DOMAIN\r\n\r\nCurrent behavior:\r\n\r\nOdoo trying to send notification email to admin user with parameters as follows:\r\nFROM: USER@CUSTOMER\r\nTO: ADMIN@gmail.com\r\n\r\nYandex mail service reject email with error:\r\nSMTPSenderRefused: 553\r\n5.7.1 Sender address rejected: not owned by auth user.\r\n\r\nExpected behavior:\r\n\r\nFROM value should be replaced, e.g. like this:\r\n\r\nFROM: catchall@DOMAIN\r\nTO: ADMIN@gmail.com\r\n\r\n\r\nThere is no such problem when gmail smtp server is used as outgoing mail server at odoo, because gmail replace wrong FROM field with a gmail account, e.g.\r\nFROM: ivan@gmail.com\r\nTO: ADMIN@gmail.com\r\n\r\nSome mail service can send email with wrong FROM field, but recepient will get warning that email was sent from another server (such behaviour was in notifcation from odoo forum https://www.odoo.com/forum/help-1 )\r\n\r\n\r\npossible solution can be found here: https://github.com/yelizariev/addons-yelizariev/blob/8.0/mail_fix_553/mail_fix_553.py\r\n\r\n\r\n    class mail_mail(osv.Model):\r\n        _inherit = \"mail.mail\"\r\n    \r\n        def send(self, cr, uid, ids, auto_commit=False, raise_exception=False, context=None):\r\n    \r\n            ...\r\n    \r\n            catchall_alias = self.pool['ir.config_parameter'].get_param(cr, uid, \"mail.catchall.alias\", context=context)\r\n            catchall_domain = self.pool['ir.config_parameter'].get_param(cr, uid, \"mail.catchall.domain\", context=context)\r\n    \r\n            correct_email_from = '@%s>?\\s*$'%catchall_domain\r\n            default_email_from = '%s@%s' % (catchall_alias, catchall_domain)\r\n    \r\n            ...\r\n    \r\n            for mail in self.browse(cr, SUPERUSER_ID, ids, context=context):\r\n    \r\n                ...\r\n    \r\n                    for email in email_list:\r\n    \r\n                        email_from = mail.email_from\r\n                        if re.search(correct_email_from, email_from) is None:\r\n                            email_from = default_email_from\r\n    \r\n                        msg = ir_mail_server.build_email(\r\n                            email_from=email_from,\r\n                            ...\r\n"},"comment":{"url":"https://api.github.com/repos/odoo/odoo/issues/comments/91828664","html_url":"https://github.com/odoo/odoo/issues/5864#issuecomment-91828664","issue_url":"https://api.github.com/repos/odoo/odoo/issues/5864","id":91828664,"user":{"login":"yelizariev","id":186131,"avatar_url":"https://avatars.githubusercontent.com/u/186131?v=3","gravatar_id":"","url":"https://api.github.com/users/yelizariev","html_url":"https://github.com/yelizariev","followers_url":"https://api.github.com/users/yelizariev/followers","following_url":"https://api.github.com/users/yelizariev/following{/other_user}","gists_url":"https://api.github.com/users/yelizariev/gists{/gist_id}","starred_url":"https://api.github.com/users/yelizariev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yelizariev/subscriptions","organizations_url":"https://api.github.com/users/yelizariev/orgs","repos_url":"https://api.github.com/users/yelizariev/repos","events_url":"https://api.github.com/users/yelizariev/events{/privacy}","received_events_url":"https://api.github.com/users/yelizariev/received_events","type":"User","site_admin":false},"created_at":"2015-04-11T11:20:45Z","updated_at":"2015-04-11T11:20:45Z","body":"@ddfs, I think we talk about different issues. I have \"Alias Domain\" setting."}}