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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Mike Stokes Sent: 15 February 2007 15:16 To: [email protected] 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 := '[EMAIL PROTECTED]'; IdMessage.Recipients.EMailAddresses := '[EMAIL PROTECTED]'; IdMessage.Subject := 'test'; IdMessage.Sender.Address := '[EMAIL PROTECTED]'; 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 [email protected] 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 [email protected] http://ns3.123.co.nz/mailman/listinfo/delphi
