[DUG] Problem embedding images in html formated email using
Indy 10
John Bird
johnkbird at paradise.net.nz
Thu Feb 15 16:30:27 NZDT 2007
This may be a red herring, but there are known issues in Thunderbird with
embedded images, for instance composing an email and pasting an image into
it from the clipboard or forwarding an email with an embedded image is
likely to lose the image. I don't know if there is a problem with
displaying embedded images in received messages in Thunderbird, but it is
worth checking on...(look in the release notes for Thunderbird re known
issues and
"broken" features).
John
-----Original Message-----
From: delphi-bounces at ns3.123.co.nz [mailto:delphi-bounces at ns3.123.co.nz] On
Behalf Of Jeremy Coulter
Sent: Thursday, 15 February 2007 3:38 p.m.
To: mike at webdata.co.nz; 'NZ Borland Developers Group - Delphi List'
Subject: RE: [DUG] Problem embedding images in html formated email using
Indy 10
Hi Mike.
I too have just been playing with this, well 2 days ago anyway.
Your code looks similar to mine, and I hade an issue where I was taking a
screen shot and putting it in an email. One of the emails (the bigger one)
was inline, the smaller one was not !! Yet, someone else in our company who
was testing it was getting them both inline every time ! I then sent an
email of the smaller email....which I should clarify as being an email with
a smaller jpg image...sent to my home email ad inline fine too....so I just
went...."whatever !!"
Jeremy
-----Original Message-----
From: delphi-bounces at ns3.123.co.nz [mailto:delphi-bounces at ns3.123.co.nz] On
Behalf Of Mike Stokes
Sent: 15 February 2007 15:16
To: Delphi at ns3.123.co.nz
Subject: [DUG] Problem embedding images in html formated email using Indy 10
Hello every one.
I am having a great deal of trouble trying to embed images using cid to
reference the attached jpeg image.
This is some test code that sends the html formatted email with the attached
image, but does not display the image in line.
I have been using Thunderbird 1.5.0.9 to test this.
Regards,
Mike
procedure TForm1.Button1Click(Sender: TObject); var
IdAttach: TIdAttachmentFile;
IdText1: TIdText;
IdText2: TIdText;
begin
IdSMTP.Host := 'smtp.maxnet.co.nz';
IdSMTP.Port := 25;
IdSMTP.Username := '';
IdSMTP.Password := '';
IdMessage.From.Address := 'mike at webdata.co.nz';
IdMessage.Recipients.EMailAddresses := 'mike at webdata.co.nz';
IdMessage.Subject := 'test';
IdMessage.Sender.Address := 'mike at webdata.co.nz';
IdMessage.ContentType := 'multipart/mixed';
IdMessage.Body.Add('<html>');
IdMessage.Body.Add('<head></head>');
IdMessage.Body.Add('<body>');
IdMessage.Body.Add('<br /><br /><span
style="color:red;font-weight:bold;">Here is the image:</span><br /><br /><br
/>');
IdMessage.Body.Add('<img src="cid:sm101yellow.jpg" />');
IdMessage.Body.Add('</body>');
IdMessage.Body.Add('</html>');
IdText1 := TIdText.Create(IdMessage.MessageParts, IdMessage.Body);
IdText1.ContentType := 'text/html';
IdText2 := TIdText.Create(IdMessage.MessageParts);
IdText2.ContentType := 'text/plain';
IdText2.Body.Text := '';
IdAttach := TIdAttachmentFile.Create(IdMessage.MessageParts,
'd:\sm101yellow.jpg');
IdAttach.ContentType := 'image/jpeg';
IdAttach.ContentDisposition := 'inline';
IdAttach.ContentID := 'sm101yellow.jpg';
IdAttach.DisplayName := 'sm101yellow.jpg';
try
try
IdSMTP.Connect;
IdSMTP.Send(IdMessage);
except
on E:Exception do
ShowMessage('Failed to send Email!'+#13#10+e.message);
end;
finally
if IdSMTP.Connected then
IdSMTP.Disconnect;
end;
Showmessage('Email Sent');
end;
_______________________________________________
Delphi mailing list
Delphi at ns3.123.co.nz http://ns3.123.co.nz/mailman/listinfo/delphi
--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.441 / Virus Database: 268.17.39/685 - Release Date: 13/02/2007
22:01
--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.441 / Virus Database: 268.17.39/685 - Release Date: 13/02/2007
22:01
_______________________________________________
Delphi mailing list
Delphi at ns3.123.co.nz http://ns3.123.co.nz/mailman/listinfo/delphi
__________ NOD32 1.1461 (20060329) Information __________
This message was checked by NOD32 antivirus system. http://www.eset.com
More information about the Delphi
mailing list