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

115 multipart html and plain text emails #179

Closed Synrom closed 1 year ago

Synrom commented 1 year ago

This pull request solves #115 by adding an alternative body to the MessageSchema and implementing functionalities for adding the alternative body in the MailMsg class.

sabuhish commented 1 year ago

Hi @Synrom, thanks for your PR. Why do we make the library more complex by adding attributes like alternative_body? Seems to me alternative_body attribute is a copy of the body, we already have a feature specifying the message should be plain or HTML.

Could you please clarify more in detail the purpose of this PR? The only difference I see only flipping the plain with the HTML value.

Synrom commented 1 year ago

Hi @sabuhish , the purpose of alternative_body is to have both a plain and a HTML attachment. This is so you don't have to write HTML only emails, but can send both formats at the same time. The receiving client can then choose what to display.

sabuhish commented 1 year ago

aren't we having this already implemented in the body attribute, with HTML and plain options?

Synrom commented 1 year ago

It could very well be, that Ive miss-read or overlooked something in the code, but I thought the feature to have an alternative body wasn't there yet. How would you create an email with an alternative body in the current version?

Synrom commented 1 year ago

Here is an exemplary implementation of what I mean using the email package: Sending html or text email with or without attachment. To my understanding this is not yet implemented in fastapi-mail.

sr-verde commented 1 year ago

aren't we having this already implemented in the body attribute, with HTML and plain options?

No, you don't have that already. I would be very glad when this feature would be part of the next release.

sr-verde commented 1 year ago

I would like to politely ask @sabuhish again to merge this PR as it is really useful. Having both plain text and HTML in a single email is a base feature in almost all mail libs.

sabuhish commented 1 year ago

Thanks to each of you guys for your contribution and for helping the growth of this library. I appreciate your work and patience here. I apologize for being late, I was too busy with side projects and could not manage my time correctly, my aim was to read and understand what is happening, therefore it took a bit of time. The changes look great to me, very well done. The only thing I may ask is to provide more examples in the documentation, you know without documentation it is a bit difficult to implement for others, if we want to make it easy for others we should provide direction to them. Thanks for the hard work and nice feature again, I will go and merge these changes and will release the new version.