Embedding attached images in HTML emails

后端 未结 7 1585
既然无缘
既然无缘 2020-12-05 08:15

If I attach an image to an email, how can I place it in the HTML content? I tried just using the filename as the image source but that doesn\'t seem to work.

相关标签:
7条回答
  • 2020-12-05 08:44

    Option 01:
    - attach the file "mySignaturePictue.jpg" as attachment to the mail
    - reference this attachment from the body (insert it) whith code like:
    <img src="cid:mySignaturePicture.png">

    Option 02:
    - convert your image to a base64 string: http://www.motobit.com/util/base64-decoder-encoder.asp
    - insert it to the mailtext/html-body with code like
    <img alt="My Image" src="data:image/jpeg;base64,AWWhcalkjsd/beginning/RXhp/of+/long/base64cod/ZgAATU0/+BlaBlubbZ5u8/61a+Xand/much/more..." />
    - Downside: this is blocked by most clients and will increase the mail size, see: https://www.campaignmonitor.com/blog/email-marketing/2013/02/embedded-images-in-html-email/ and https://www.paperstreet.com/blog/email-marketing-embeded-images-cid-what-a-mess/

    0 讨论(0)
提交回复
热议问题