Usuário com melhor resposta
duvida em html no email

Pergunta
-
Tenho um sistema que dispara email com dados do cliente, ams me pediram pra colocar uma figura no corpo do email e me passaram o codigo html dela, sou iniciante e não fiz nada assim ainda, como devo proceder?
codigo html
<html> <head> <title>comunicado_btc_fatiado</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"> <!-- ImageReady Slices (comunicado_btc_fatiado.ai) --> <table id="Table_01" width="624" height="871" border="0" cellpadding="0" cellspacing="0"> <tr> <td colspan="4" align="left" valign="top"> <img src="http://www.uminvestimentos.com.br/ftp1/News/btc/comunicado_btc_fatiado_01.jpg" width="624" height="495" alt=""></td> </tr> <tr> <td colspan="4"> <img src="http://www.uminvestimentos.com.br/ftp1/News/btc/comunicado_btc_fatiado_02.jpg" width="624" height="22" alt=""></td> </tr> <tr> <td rowspan="19"> <img src="http://www.uminvestimentos.com.br/ftp1/News/btc/comunicado_btc_fatiado_03.jpg" width="225" height="254" alt=""></td> <td align="left" valign="top"> <img src="http://www.uminvestimentos.com.br/ftp1/News/btc/comunicado_btc_fatiado_04.jpg" width="279" height="24" alt=""></td> <td colspan="2" rowspan="19"> <img src="http://www.uminvestimentos.com.br/ftp1/News/btc/comunicado_btc_fatiado_05.jpg" width="120" height="254" alt=""></td> </tr> <tr> <td> <img src="http://www.uminvestimentos.com.br/ftp1/News/btc/comunicado_btc_fatiado_06.jpg" width="279" height="2" alt=""></td> </tr> <tr> <td align="left" valign="top"> <img src="http://www.uminvestimentos.com.br/ftp1/News/btc/comunicado_btc_fatiado_07.jpg" width="279" height="24" alt=""></td> </tr> <tr> <td align="left" valign="top"> <img src="http://www.uminvestimentos.com.br/ftp1/News/btc/comunicado_btc_fatiado_08.jpg" width="279" height="24" alt=""></td> </tr> <tr> <td> <img src="http://www.uminvestimentos.com.br/ftp1/News/btc/comunicado_btc_fatiado_09.jpg" width="279" height="1" alt=""></td> </tr> <tr> <td align="left" valign="top"> <img src="http://www.uminvestimentos.com.br/ftp1/News/btc/comunicado_btc_fatiado_10.jpg" width="279" height="24" alt=""></td> </tr> <tr> <td> <img src="http://www.uminvestimentos.com.br/ftp1/News/btc/comunicado_btc_fatiado_11.jpg" width="279" height="1" alt=""></td> </tr> <tr> <td align="left" valign="top"> <img src="http://www.uminvestimentos.com.br/ftp1/News/btc/comunicado_btc_fatiado_12.jpg" width="279" height="24" alt=""></td> </tr> <tr> <td> <img src="http://www.uminvestimentos.com.br/ftp1/News/btc/comunicado_btc_fatiado_13.jpg" width="279" height="2" alt=""></td> </tr> <tr> <td align="left" valign="top"> <img src="http://www.uminvestimentos.com.br/ftp1/News/btc/comunicado_btc_fatiado_14.jpg" width="279" height="23" alt=""></td> </tr> <tr> <td> <img src="http://www.uminvestimentos.com.br/ftp1/News/btc/comunicado_btc_fatiado_15.jpg" width="279" height="1" alt=""></td> </tr> <tr> <td align="left" valign="top"> <img src="http://www.uminvestimentos.com.br/ftp1/News/btc/comunicado_btc_fatiado_16.jpg" width="279" height="24" alt=""></td> </tr> <tr> <td> <img src="http://www.uminvestimentos.com.br/ftp1/News/btc/comunicado_btc_fatiado_17.jpg" width="279" height="1" alt=""></td> </tr> <tr> <td align="left" valign="top"> <img src="http://www.uminvestimentos.com.br/ftp1/News/btc/comunicado_btc_fatiado_18.jpg" width="279" height="24" alt=""></td> </tr> <tr> <td> <img src="http://www.uminvestimentos.com.br/ftp1/News/btc/comunicado_btc_fatiado_19.jpg" width="279" height="1" alt=""></td> </tr> <tr> <td align="left" valign="top"> <img src="http://www.uminvestimentos.com.br/ftp1/News/btc/comunicado_btc_fatiado_20.jpg" width="279" height="24" alt=""></td> </tr> <tr> <td> <img src="http://www.uminvestimentos.com.br/ftp1/News/btc/comunicado_btc_fatiado_21.jpg" width="279" height="2" alt=""></td> </tr> <tr> <td align="left" valign="top"> <img src="http://www.uminvestimentos.com.br/ftp1/News/btc/comunicado_btc_fatiado_22.jpg" width="279" height="23" alt=""></td> </tr> <tr> <td> <img src="http://www.uminvestimentos.com.br/ftp1/News/btc/comunicado_btc_fatiado_23.jpg" width="279" height="5" alt=""></td> </tr> <tr> <td colspan="3" align="left" valign="top"> <img src="http://www.uminvestimentos.com.br/ftp1/News/btc/comunicado_btc_fatiado_24.jpg" width="623" height="99" alt=""></td> <td> <img src="http://www.uminvestimentos.com.br/ftp1/News/btc/comunicado_btc_fatiado_25.jpg" width="1" height="99" alt=""></td> </tr> <tr> <td> <img src="http://www.uminvestimentos.com.br/ftp1/News/btc/spacer.gif" width="225" height="1" alt=""></td> <td> <img src="http://www.uminvestimentos.com.br/ftp1/News/btc/spacer.gif" width="279" height="1" alt=""></td> <td> <img src="http://www.uminvestimentos.com.br/ftp1/News/btc/spacer.gif" width="119" height="1" alt=""></td> <td> <img src="http://www.uminvestimentos.com.br/ftp1/News/btc/spacer.gif" width="1" height="1" alt=""></td> </tr> </table> <!-- End ImageReady Slices --> </body> </html>
meu codigo de disparo de email
Try Dim mail As New MailMessage() mail.From = New MailAddress("marcelo.cerri@uminvestimentos.com.br") 'email para de destino mail.To.Add("rafael.nogueira@eum.com.br") 'email para quem enviou mail.CC.Add("marcelo.cerri@uminvestimentos.com.br") mail.Subject = "Teste de Envio de Movimentação" ' o Assunto do Email Dim plainView As AlternateView = AlternateView.CreateAlternateViewFromString("This is my plain text content, viewable by those clients that don't support html", Nothing, "text/plain") Dim texto As String texto = "<b> Código ||" + DGDbtc.CurrentRow.Cells(0).Value.ToString + " ||" + " Tipo||" + DGDbtc.CurrentRow.Cells(1).Value.ToString + " ||" + " Contrato||" + DGDbtc.CurrentRow.Cells(3).Value.ToString + " ||" + " Abertura|| " + DGDbtc.CurrentRow.Cells(4).Value.ToString + " ||" + " Doarev||" + DGDbtc.CurrentRow.Cells(5).Value.ToString + "||</b><br>" & Environment.NewLine & _ " <b>_________________________________________________________________________________<br>" & Environment.NewLine & _ " <b> Vencimento|| " + DGDbtc.CurrentRow.Cells(6).Value.ToString + " ||" + " Carência||" + DGDbtc.CurrentRow.Cells(7).Value.ToString + " ||" + " Qtd||" + DGDbtc.CurrentRow.Cells(8).Value.ToString + " ||" + " Preço de Liq.|| " + DGDbtc.CurrentRow.Cells(9).Value.ToString + " ||" + " Taxa %||" + DGDbtc.CurrentRow.Cells(10).Value.ToString + " ||.<br>" & Environment.NewLine & _ " <b>_________________________________________________________________________________<br>" & Environment.NewLine & _ "Este é um e-mail de teste e foi enviado pelo Outlook.<br>" & Environment.NewLine & "" Dim body As String = texto Dim htmlView As AlternateView = AlternateView.CreateAlternateViewFromString("<img src=cid:companylogo> <p> <class='body'> " + body + "</div> <img src=cid:Comlog> ", Nothing, "text/html") Dim logo As New LinkedResource("C:\Projetos\BTC_UM\BTC_UM\logo_um.jpg") '("C:\Projetos\BTC_UM\BTC_UM\wallpaper copy.jpg") Dim logo1 As New LinkedResource("C:\Projetos\BTC_UM\BTC_UM\logo_um.jpg") logo.ContentId = "companylogo" logo1.ContentId = "Comlog" htmlView.LinkedResources.Add(logo) htmlView.LinkedResources.Add(logo1) With mail .AlternateViews.Add(plainView) .AlternateViews.Add(htmlView) End With mail.IsBodyHtml = True Dim smtp As New SmtpClient("smtpm.eum.com.br") 'informe o nome do SMTPclient que seria de quem está enviando smtp.Send(mail) ' e envie o email Catch ex As Exception 'caso haja algum erro crie uma msg de aviso. MsgBox(ex.Message) Finally MsgBox("Email enviado com sucesso!!") ' File.Delete("") End Try
Respostas
-
Bem assim eu estou conseguindo colocar as imagens
Dim htmlView As AlternateView = AlternateView.CreateAlternateViewFromString("<img src=http://www.uminvestimentos.com.br/ftp1/News/btc/comunicado_btc_fatiado_01.jpg> <img src=http://www.uminvestimentos.com.br/ftp1/News/btc/comunicado_btc_fatiado_03.jpg> <img src=http://www.uminvestimentos.com.br/ftp1/News/btc/comunicado_btc_fatiado_02.jpg> <class='body'> " + body + "</div> <img src=cid:Comlog>", Nothing, "text/html")
- Marcado como Resposta RJCERRI terça-feira, 2 de julho de 2013 15:39
Todas as Respostas
-
Tentando eu fiz essa mudança
Dim logo As New LinkedResource("C:\Projetos\BTC_UM\BTC_UM\logo_um.jpg") '("C:\Projetos\BTC_UM\BTC_UM\wallpaper copy.jpg") Dim logo1 As New LinkedResource("http://www.uminvestimentos.com.br/ftp1/News/btc/comunicado_btc_fatiado_01.jpg")
mas assim da esse erro URl formats are not supported.
Sei que to chutando mas eu não tenho a menos ideia de como usar isso.
-
-
Bem assim eu estou conseguindo colocar as imagens
Dim htmlView As AlternateView = AlternateView.CreateAlternateViewFromString("<img src=http://www.uminvestimentos.com.br/ftp1/News/btc/comunicado_btc_fatiado_01.jpg> <img src=http://www.uminvestimentos.com.br/ftp1/News/btc/comunicado_btc_fatiado_03.jpg> <img src=http://www.uminvestimentos.com.br/ftp1/News/btc/comunicado_btc_fatiado_02.jpg> <class='body'> " + body + "</div> <img src=cid:Comlog>", Nothing, "text/html")
- Marcado como Resposta RJCERRI terça-feira, 2 de julho de 2013 15:39