Fórum Enviar email em HTML com imagem em anexo #337041
31/01/2007
0
Li vários tópicos aqui no forum que falavam sobre o envio de email no formato HTML mostrando a imagem ´inline´ e infelizmente ainda não consegui.
Estou tentando assim:
begin //Configurando o servidor SMTP ConfigSMTP; IdSMTP1.Connect; try if IdSMTP1.Connected then begin with IdMessage1 do begin Subject := ´Teste de envio de mensagem com html mostrando uma imagem "inline"´; From.Name := ´Carlos Alberto ´+FormatDateTime(´ hh:mm:ss:zzz´, now); From.Address := ´carlos@carlos.eti.br´; Recipients.Add.Address := ´carlos_am@hotmail.com´; Recipients.Add.Address := ´carlosib_2005@click21.com.br´; ContentType := ´multipart/alternative´; ContentDisposition := ´inline´; Encoding := meMIME; end; //Part 0 TXT. with TIdText.Create(IdMessage1.MessageParts) do begin Body.Clear; Body.Add(´Mensagem texto´); ContentType := ´text/plain´; ContentTransfer := ´7bit´; end; with TIdText.Create(IdMessage1.MessageParts) do begin Body.Clear; ContentType := ´multipart/related´; ContentTransfer := ´7bit´; end; //Part 1 HTML. with TIdText.Create(IdMessage1.MessageParts) do begin Body.Clear; Body.LoadFromFile(´c:\mala.html´); //File HTML ContentType := ´text/html´; ContentTransfer := ´7bit´; end; with TIdAttachment.Create(IdMessage1.MessageParts, ´c:\CAP1.jpg´) do begin ContentType := ´image/jpg´; ContentDisposition := ´inline´; ContentTransfer := ´base64´; Headers.Clear; Headers.Add(´Content-ID: <CAP1.jpg>´); end; IdSMTP1.Send(IdMessage1); end; finally end;
O conteúdo do arquivo ´Mala.html´ é:
<html> <head> </head> <body> <p>Veja a imagem abaixo:</p> <p><img border="0" src="CAP1.jpg" width="1024" height="768"></p> </body> </html>
No webmail do hotmail do click21 e no outlook express vejo a imagem dessa forma:
HOTMAIL:
[img:ac17df0362]http://www.agenda.eti.br/delphi/hotmail.JPG[/img:ac17df0362]
CLICK21:
[img:ac17df0362]http://www.agenda.eti.br/delphi/click21.JPG[/img:ac17df0362]
OUTLOOK EXPRESS
[img:ac17df0362]http://www.agenda.eti.br/delphi/outlook_express.JPG[/img:ac17df0362]
Alguém consegue ver o que estou fazendo de errado?
Uso Delphi 7 - Indy 9.0.19
Carlosib
Curtir tópico
+ 0Posts
31/01/2007
Massuda
Gostei + 0
01/02/2007
Carlosib
gerei esse código HTML com o front page:
<html> <title>Teste de envio de email com imagem anexo e outros arquivos</title> <body> <h1><font color="#008000" face="ATICHAR">Teste de envio de mensagem....</font></h1> <p><a href="http://www.agenda.eti.br"><img border="0" src="cid:0123456789" width="500" height="1000"></a></p> </body> </html>
O código que adicionar a imagem ´inline´ no email é:
TheAttachment := TIdAttachmentFile.Create(TheMessage.MessageParts, ExtractFilePath(ParamStr(0))+´imagem.jpg´); TheAttachment.ContentTransfer := ´base64´; //Next line works on most extensions, a real app would do this properly... TheAttachment.ContentType := ´image/jpg´// TheAttachment.ContentID := ´<0123456789>´; TheAttachment.ParentPart := 0;
No outlook, webmail do click21 a imagem é mostrada. No webmail do HOTMAIL a imagem não é mostrada.
Você saberia me dizer porque?
WEBMAIL CLICK21
[img:a519629b07]http://www.agenda.eti.br/email/webmail01.jpg[/img:a519629b07]
HOTMAIL
[img:a519629b07]http://www.agenda.eti.br/email/hotmail01.jpg[/img:a519629b07]
OUTLOOK EXPRESS
[img:a519629b07]http://www.agenda.eti.br/email/outlook01.jpg[/img:a519629b07]
Como devo fazer para que o webmail do HOTMAIL mostre a imagem?
Gostei + 0
01/02/2007
Massuda
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)