-
-
Notifications
You must be signed in to change notification settings - Fork 606
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
[15.0][MIG] mail_outbound_static: Migration to 15.0 #841
[15.0][MIG] mail_outbound_static: Migration to 15.0 #841
Conversation
* Allow for the configuration of the FROM header for outbound emails, and move the existing from header to Sender as per RFC-2822
Fixing and extending tests Add setup
Co-Authored-By: Jairo Llopis <Yajo@users.noreply.github.com>
use sudo to get ir.config_parameter, otherwise when normal users try to send email they get AccessError
- fix misspellings errors in documentation - add unit test to avoid github checkers red status in codecov tests. - add validation of email from and domain whitelist fields. - update documentation remove roadmap for already updated functionalities. - update translations
@simahawk can you pls take a look? |
@yankinmax pls check the build |
from odoo.exceptions import ValidationError | ||
from odoo.tests.common import TransactionCase | ||
|
||
from odoo.addons.base.tests.common import MockSmtplibCase |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@simahawk @rousseldenis
With this improvement odoo/odoo@1b9dd11
I propose to improve tests, as they are failing using https://docs.python.org/3/library/unittest.mock.html#module-unittest.mock
def _send_mail( | ||
self, | ||
message, | ||
mail_server_id=None, | ||
smtp_server=None, | ||
smtp_port=None, | ||
smtp_user=None, | ||
smtp_password=None, | ||
smtp_encryption=None, | ||
smtp_ssl_certificate=None, | ||
smtp_ssl_private_key=None, | ||
smtp_debug=False, | ||
smtp_session=None, | ||
): | ||
smtp = smtp_session | ||
if not smtp: | ||
smtp = self.IrMailServer.connect( | ||
smtp_server, | ||
smtp_port, | ||
smtp_user, | ||
smtp_password, | ||
smtp_encryption, | ||
smtp_from=message["From"], | ||
ssl_certificate=smtp_ssl_certificate, | ||
ssl_private_key=smtp_ssl_private_key, | ||
smtp_debug=smtp_debug, | ||
mail_server_id=mail_server_id, | ||
) | ||
|
||
send_from, send_to, message_string = self.IrMailServer._prepare_email_message( | ||
message, smtp | ||
) | ||
self.IrMailServer.send_email(message) | ||
return message_string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is needed, just because, I'm not an expert with email servers and couldn't find any other idea how to get smtp_seesion
parameter to pass directly to _prepare_email_message
method of ir.mail_server
.
Would really appreciate any guidance. Thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems legit, but It is maybe not necessary anymore if we have a good setup of the system parameters and this commit -> odoo/odoo@044532a
This PR has the |
hmm it's slightly different here as the FROM comes from the server record and not from config param. https://github.com/odoo/odoo/blob/15.0/odoo/addons/base/models/ir_mail_server.py I'd add a TODO to evaluate overriding @gurneyalex what do you think? |
/ocabot merge nobump |
Hey, thanks for contributing! Proceeding to merge this for you. |
Congratulations, your PR was merged at 8902b1e. Thanks a lot for contributing to OCA. ❤️ |
Including commits from PR #598