Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

STMP 'From:' and 'SMTP FROM:' headers not consistent #117095

Open
gautier-levert opened this issue Mar 30, 2023 · 5 comments
Open

STMP 'From:' and 'SMTP FROM:' headers not consistent #117095

gautier-levert opened this issue Mar 30, 2023 · 5 comments
Labels
16.0 Framework General frontend/backend framework issues Marketing CRM, mail, event, livechat, mass mailing, online appointments, ...

Comments

@gautier-levert
Copy link

gautier-levert commented Mar 30, 2023

Impacted versions: Odoo 16.0-20230317 (Edition Community)

Steps to reproduce:

  • Configure SMTP server with custom domain (connection test is successful)
  • Configure mail.catchall.domain property to correspond with SMTP server domain.
  • Try to send mail (for example : "Send password reset instructions" in users)

Current behavior:
Mail not sent, SMTP refuse request with following error:

RPC_ERROR
Odoo Server Error
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_mail_server.py", line 686, in send_email
    smtp.send_message(message, smtp_from, smtp_to_list)
  File "/usr/lib/python3.9/smtplib.py", line 970, in send_message
    return self.sendmail(from_addr, to_addrs, flatmsg, mail_options,
  File "/usr/lib/python3.9/smtplib.py", line 892, in sendmail
    raise SMTPDataError(code, resp)
smtplib.SMTPDataError: (501, b"5.5.1 The 'From:' header and the 'SMTP FROM:' envelope information are not consistent, DKIM signature would fail")

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 1584, in _serve_db
    return service_model.retrying(self._serve_ir_http, self.env)
  File "/usr/lib/python3/dist-packages/odoo/service/model.py", line 134, in retrying
    result = func()
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 1611, in _serve_ir_http
    response = self.dispatcher.dispatch(rule.endpoint, args)
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 1808, in dispatch
    result = self.request.registry['ir.http']._dispatch(endpoint)
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_http.py", line 149, in _dispatch
    result = endpoint(**request.params)
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 699, in route_wrapper
    result = endpoint(self, *args, **params_ok)
  File "/usr/lib/python3/dist-packages/odoo/addons/web/controllers/dataset.py", line 46, in call_button
    action = self._call_kw(model, method, args, kwargs)
  File "/usr/lib/python3/dist-packages/odoo/addons/web/controllers/dataset.py", line 33, in _call_kw
    return call_kw(request.env[model], method, args, kwargs)
  File "/usr/lib/python3/dist-packages/odoo/api.py", line 461, in call_kw
    result = _call_kw_multi(method, model, args, kwargs)
  File "/usr/lib/python3/dist-packages/odoo/api.py", line 448, in _call_kw_multi
    result = method(recs, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/odoo/addons/auth_signup/models/res_users.py", line 203, in action_reset_password
    template.send_mail(user.id, force_send=force_send, raise_exception=True, email_values=email_values)
  File "/usr/lib/python3/dist-packages/odoo/addons/mail/models/mail_template.py", line 402, in send_mail
    mail.send(raise_exception=raise_exception)
  File "/usr/lib/python3/dist-packages/odoo/addons/mail/models/mail_mail.py", line 408, in send
    self.browse(batch_ids)._send(
  File "/usr/lib/python3/dist-packages/odoo/addons/mail/models/mail_mail.py", line 514, in _send
    res = IrMailServer.send_email(
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_mail_server.py", line 697, in send_email
    raise MailDeliveryException(_("Mail Delivery Failed"), msg)
odoo.addons.base.models.ir_mail_server.MailDeliveryException: ('Mail Delivery Failed', "Mail delivery failed via SMTP server 'None'.\nSMTPDataError: 501\n5.5.1 The 'From:' header and the 'SMTP FROM:' envelope information are not consistent, DKIM signature would fail")

The above server error caused the following client error:
RPC_ERROR: Odoo Server Error
    RPCError@https://odoo.sopht.io/web/assets/212-377c94d/web.assets_backend.min.js:963:274
    makeErrorFromResponse@https://odoo.sopht.io/web/assets/212-377c94d/web.assets_backend.min.js:967:163
    jsonrpc/promise</<@https://odoo.sopht.io/web/assets/212-377c94d/web.assets_backend.min.js:975:34

Expected behavior:
Mail correctly sent.

Screenshots :

Screenshot 2023-03-30 at 08-53-18 Odoo - Scaleway sopht io

Screenshot 2023-03-30 at 08-53-41 Odoo - System Parameters

@vava-odoo vava-odoo added Framework General frontend/backend framework issues 16.0 labels Mar 30, 2023
@Feyensv Feyensv added the Marketing CRM, mail, event, livechat, mass mailing, online appointments, ... label Mar 31, 2023
@AbdelAzizMohamedMousa
Copy link

It looks like there is an issue with the SMTP configuration in Odoo 16.0-20230317 (Community Edition). The SMTP server is configured with a custom domain and the mail.catchall.domain property is set to correspond with the SMTP server domain. However, when attempting to send an email, the SMTP server is refusing the request with the error message "5.5.1 The 'From:' header and the 'SMTP FROM:' envelope information are not consistent, DKIM signature would fail".

This error suggests that the 'From:' header and the 'SMTP FROM:' envelope information are not matching, which is causing an issue with the DKIM signature. DKIM is a method for validating the authenticity of email messages. In this case, it appears that the SMTP server is detecting a mismatch between the 'From:' header and the 'SMTP FROM:' envelope information, which is causing the DKIM signature to fail.

To resolve this issue, you should verify that the 'From:' header and the 'SMTP FROM:' envelope information are consistent with each other. You may need to update your email configuration settings in Odoo to ensure that both of these elements are correctly configured. You may also need to check with your email provider to ensure that they are correctly configured to support DKIM.

@ossimantylahti
Copy link
Contributor

This is a well-known issue with Odoo's default e-mail being incorrectly set up. By default Odoo tries to send e-mail that is originating from non-odoo domain (like gmail.com). This is obviously not the right way to do it.

Fortunately even if Odoo's default configuration is wrong, the problem can be fixed with a configuration change.

In order for this to work you need to configure Odoo to always use only one fixed e-mail (i.e. odoo@myodoodomain.com)

Create e-mail account odoo@myodoodomain.com
set aliases bounce and catchall for this e-mail address.

Set mail.catchall.domain to myodoodomain.com
Modify mail.default.from and set to odoo@myodoodomain.com
Add mail.default.from_filter and set to odoo@myodoodomain.com

@gautier-levert
Copy link
Author

Thank you for your help, I tried to configure catchall alias and domain with system keys :
Screenshot 2023-04-20 at 16-13-14 Odoo - Paramètres système
I continue to receive the same error.

@ossimantylahti
Copy link
Contributor

I continue to receive the same error.

That is because your domain's SPF, DKIM and DMARC settings are not correctly set (just checked). (Drop me a private message and I'll be happy to help you to configure them. This is offtopic for this chain).

@gautier-levert
Copy link
Author

I have personaly configured SPF, DKIM and DMARC for the domain and it works perfectly for other services with the same SMTP server. I'd be happy to get help, how can I contact you in DM ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
16.0 Framework General frontend/backend framework issues Marketing CRM, mail, event, livechat, mass mailing, online appointments, ...
Projects
None yet
Development

No branches or pull requests

5 participants