Uiot
Uiot

Reputation: 83

Should I link to images when sending a html Email or use `AddEmbeddedImage`?

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

Answers (1)

Synchro
Synchro

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:

  • Does not require a connection to display images
  • For that reason, is often permitted by default, not blocked by filters
  • Images remain working even if the original site goes offline

Cons of embedding/attaching:

  • Messages are bigger and slower to send, consume unnecessary bandwidth regardless of whether the recipient reads the message
  • Unfriendly to mobile as it prevents them exercising control over the image display

Pros of linking:

  • Messages are much smaller & faster to send
  • Images are not downloaded until the message is viewed, making traffic much less "peaky"
  • Images can be revised after sending (e.g. rendered dynamically when a message is read)
  • Images do not appear as attachments
  • Images are not used at all by recipients who prefer plain text (e.g. those with visual impairments)

Cons of linking:

  • Image display is blocked by default in most email clients

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

Related Questions