sabuhish / fastapi-mail

Fastapi mail system sending mails(individual, bulk) attachments(individual, bulk)
https://sabuhish.github.io/fastapi-mail/
MIT License
673 stars 82 forks source link

Using template_body forces message type to HTML #176

Closed rambo closed 1 year ago

rambo commented 1 year ago

if type is not set defaulting to HTML when message_body is used could make some sense and in any case should be done for backwards compatibility, but if type is explicitly set to plain then it should not be overridden.

https://github.com/sabuhish/fastapi-mail/blob/master/fastapi_mail/schemas.py#L82

Workaround is of course to just use Jinja yourself to render the body and not use template_body at all.

sabuhish commented 1 year ago

Hi @rambo, right, at this point we thought, rendering the template with jinja could be done to HTML files, so the subtype should be HTML not plain. As I see your concerns, thinking could be that file content does not have HTML tags. Actually, we were thinking to remove template_body completely and keep body instead. This should not be overridden, you are right, the control should be given to the users.

sabuhish commented 1 year ago

Hey @rambo, below PR should solve your problem. Could you please also confirm it?

188

sabuhish commented 1 year ago

this is released in 1.3.0 version