Is it possible to insert a picture into a letter? If so, how to do it? Thank.

    2 answers 2

    We assume that with the sending of letters as such through Java Mail figured out.

    Put the picture in the attachment and put the attachment header ( setContentID )

    Content-ID: <my.image.id> 

    Text body make text / html and refer to the image as follows:

     <img alt="test" src="cid:my.image.id" /> 

    So after the link that you gave exactly this and described below .. so I do not understand why you decided that you can not

    • Those. It turns out that the image goes as an attachment and is displayed in the message itself? - Jenkamen
    • That's right - cy6erGn0m

    Of course it is possible. Here is how it is described , for example. In fact, you either compose a letter in HTML and insert <img> or add an attachment to the letter.

    • Suppose an attachment, but how to insert this picture into the text in a certain place? And how does this differ from the link to the drawing? - Jenkamen
    • If you attach the attachment, then in a certain place to insert will not work. - yozh
    • How it will not work? And how come. - cy6erGn0m
    • +1 I meant, however, that if you use the attachment, it is because for some reason not to use HTML. - yozh