Reputation: 83
I've seen that when using addEmbeddedImage()
Images appear as attachments in the email, which seems kind of weird if I want to send a confirmation email for an account, or a password change and stuff like that. When I checked other emails from other websites they just use links as the source of the image.
Is this the best practice? If so, should I host the images that I'm using in emails in a special way, or anywhere among the other website files is fine ?
Upvotes: 1
Views: 575
Reputation: 37770
Embedded images are also attachments. What makes them different is that they have cid
values, so HTML in the same message can reference them. Whether images are displayed inline as well as displayed as attachments is dependent on the mail client, so you'd need to test it for your particular application.
Pros of embedding/attaching:
Cons of embedding/attaching:
Pros of linking:
Cons of linking:
If you're just doing a one-time send of a couple of images (e.g. family), embedding/attaching is appropriate, but if you're sending high volumes, linked images are usually preferable. If you're thinking of putting images in your email signatures, don't - it's possible to make good-looking email layouts without using images. Also be aware that Outlook's image handling is particularly bad.
How you choose to serve the images is irrelevant - the client can't tell whether you're serving static images from files or rendering something dynamically, so just serve them like you would for a web site.
Upvotes: 2