Insert image into email body

Asked

Viewed 1,678 times

4

How do I insert an image into the body of the email using C# ? I have already been able to send as an attachment but I would like to know how to proceed to send it in the body of the email , has something that enables this ?

  • Enter the code of how you are generating the email, then we will be able to help better.

2 answers

3

Make your email send as HTML.

message.IsBodyHtml = true;
message.Body = "<p>Veja essa imagem</p> <br/><br/><img src=\"cid:localDaImagem\" />"
  • I don’t think you need to declare the html and body tag, the email itself already identifies when it sends html tags to it

  • Probably not even need, I can not test now. When I am sure change the answer.

  • I have, look at the source I put in my answer.

  • 1

    Not that I’m doubting you, but Ocaweb is a bad source for this kind of information.

  • More there was the only place I found in what should be used or not of HTML and still speaks some differences between email services that have to make changes in HTML tags. If you find a safer source, put it to us, the community thanks you and so do I. : D

2

Where do you put the body email, you will assign tags HTML. Example:

myMessage.message = "<img src='caminho_da_imagem' alt='Imagem' />"

I’m using the myMessage.message as if it were the body parameter of the email you are sending.

The Wiki do Locaweb gives some tips on what you should use for these types of emails.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.