1
votes

I am using google api message/send api to send a mail with text and inline image. I could define my MIME message as follows if I am going to use only an html content to embed my image.

Content-Type: multipart/related; boundary="0000000000000b2adf056874bbe4"

--0000000000000b2adf056874bbe4
Content-Type: multipart/alternative; boundary="0000000000000b2adc056874bbe3"

--0000000000000b2adc056874bbe3
Content-Type: text/plain; charset="UTF-8"



--0000000000000b2adc056874bbe3
Content-Type: text/html; charset="UTF-8"

<img src="cid:image-Picture2.jpg">

--0000000000000b2adc056874bbe3--
--0000000000000b2adf056874bbe4
Content-Type: image/jpeg; name="Picture2.jpg"
Content-Disposition: inline; filename="Picture2.jpg"
Content-Transfer-Encoding: base64
Content-ID: <image-Picture2.jpg>

<base 64 encoded jpg image here>

--0000000000000b2adf056874bbe4--

But I want to use a text/plain content as well.

--0000000000000b2adc056874bbe3
Content-Type: text/plain; charset="UTF-8"

Hello this is the text/plain content.

--0000000000000b2adc056874bbe

But whenever I send a text plain content which is not empty as above, I will always get my mail without the text content and only with the image inline. I want to know how to send a text/plain with an inline image via gmail api.

1

1 Answers

2
votes

As far as I tried to accomplish this, I have realized that sending inline images can only be achieved using an HTML body content only.