plone / guillotina

Python AsyncIO data API to manage billions of resources
https://guillotina.readthedocs.io/en/latest/
Other
187 stars 50 forks source link

Pass variable arguments to SMTPMailEndpoint (smtp) #1153

Closed nilbacardit26 closed 2 years ago

nilbacardit26 commented 2 years ago

I wonder if it can be a good idea to pass variable arguments coming from the configuration of guillotina to the aiosmtplib.SMTP instance of the MailerUtility.

Context: Right now, we have a client that has a smtp server with an invalid certificate, with a hostname mismatch:

aiosmtplib.errors.SMTPConnectError: Error connecting to ****** on port 465: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: Hostname mismatch, certificate is not valid for *******. (_ssl.c:1108)

The easy and filthy shortcut to that would be to be able to instantiate aiosmtplib.SMTP with the validate_certs flag set to false. I know this is not the preferable solution, and I am aware of the dangers, but at this point, the client prefers to send the email rather than contacting the hosting provider to change this certificate. If you think it is a good idea to be able to pass these arguments as a **kwargs in the aiosmtplib.SMTP instead of only: https://github.com/plone/guillotina/blob/master/guillotina/contrib/mailer/utility.py#L49 I will open a PR.

masipcat commented 2 years ago

sounds good to me