sabuhish / fastapi-mail

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

Implemented Custom Headers to Mails #118

Closed SionAbes closed 2 years ago

SionAbes commented 2 years ago

What? ✨

Allows users to add custom SMTP headers to email requests

Related to this issue raised on Custom SMTP Headers

Why? 📝

Some email providers allow users to attach custom SMTP headers for specific operations, such as custom ids to track the status of mails with webhooks. I thought this would be a great little feature to add to fastapi-mail.

How? 🔧

SionAbes commented 2 years ago

Just some extra testing: We implemented this fork into our production stack, and it appears to be working as intended. The only hiccup is that you do have to stringify the value of the header if its a sub dict eg:

from json import dumps
{"custom_header": dumps({"my_id":1})}
sabuhish commented 2 years ago

Good evening @SionAbes, Thanks a lot for your great job. I loved the way you explained things in detail, made us happier. I used mailgun once with my teammates, never realized such things at that time. Thanks for first finding the issue and without hesitating you have created PR. That is beautiful and very kind of you! I will release a new version, instead of fork, you can download it from pypi.