Can you and how do you embed images in an email when using the Gmail API? -
when creating message , using create draft or email using gmail api, can have image embedded in body? i'm looking have image data embedded similar how copying , pasting image (the actual data, not link) gmail email place image right in content.
can done or need upload image other location , use html embed image in email? pointers on how it?
the short answer same way email service.
the long answer need create multipart/related message, 1 part html content of email , other part image. image part contains content-id header specifies id image, , html image tag references id in src
attribute using format cid:id_here
.
an example of how construct such email in python here: https://stackoverflow.com/a/1633493
p.s. - great way see how emails constructed @ raw message. can @ raw message given email in gmail clicking drop down arrow next message , selecting "show original".
Comments
Post a Comment