Open sigalor opened 4 years ago
As a side note, some email clients will show embedded images as attachments and some email servers will stripe them out completely. There isn't a great way to guarantee images are always displayed without problems. I do believe that externally hosted images is still the recommended solution for most clients. This is how most email platforms (i.e. Mailchimp and the like) serve images.
Allow adding images via Content-ID to email templates
Problem
Currently, it is not possible to directly embed images into the email templates in the form of attachments, i.e. using the
Content-ID
field (see this Stack Overflow answer for a short explanation). Yet, using this field is the best option for maximum compatibility.Solution
One option to solve this would be the following workflow:
logo.png
.<img src="cid:logo.png"/>
to any HTML email template.img
tag with asrc
attribute starting withcid:
. In the example, FusionAuth would thus findlogo.png
and, because it knows there already is alogo.png
in the dump of possible email attachments, it would automatically attach this file to the sent out email.Alternatives/workarounds
There are currently two major workarounds that both have their drawbacks:
<img src="data:image/png;base64,iVBORw0..."/>
. Most major email clients (especially Outlook and Gmail) completely block these or filter them out (see here).<img src="https://mypage.com/logo.png"/>
. Some email clients block these by default (e.g. Thunderbird and Outlook) and of course to some users a message like "Some content from this email was blocked to protect your privacy" might seem suspicious.Another option is to set up your own SMTP proxy. FusionAuth will then only send emails to this proxy, the proxy takes these emails and adds the required image attachments itself (essentially executing step 3 of the possible solution mentioned above) and then forwards them to the actual recipient.
How to vote
Please give us a thumbs up or thumbs down as a reaction to help us prioritize this feature. Feel free to comment if you have a particular need or comment on how this feature should work.