Board index » delphi » Trying a solution to my idsmtp problem...
RAO
![]() Delphi Developer |
Trying a solution to my idsmtp problem...2005-11-06 10:07:32 AM delphi36 I said in my post... my english is so bad... which example i have to use? related, non related? which example?, the article I have see... "Remy Lebeau (TeamB)" <XXXX@XXXXX.COM>escreveu na mensagem Quote
understand very well... how can I change this code to see the image only in the HTML sended... not in attachments. here is the code... ---------------------------------------------------------------- function SendIndyHTMLMail(Host, FromAddr, ToAddr, Subject, FileName, User, Pass: String; Images: TStringList): Boolean; var SMTP: TIdSMTP; Msg: TIdMessage; Bdy: TIdText; Img: TIdAttachmentfile; I: Integer; begin Result := False; SMTP := TIdSMTP.Create(Nil); Msg := TIdMessage.Create(Nil); Msg.From.Text := FromAddr; Msg.Recipients.EMailAddresses := ToAddr; Msg.Subject := Subject; // Msg.ContentType := 'multipart/mixed'; //Bdy := TIdText.Create(Msg.MessageParts); //Bdy.ContentType := 'text/plain'; //Bdy.Body.Add('This mail was sent in html format. Please open the attached file.'); Bdy := TIdText.Create(Msg.MessageParts); Bdy.ContentType := 'text/html'; Bdy.Body.LoadFromFile(FileName); bdy.ParentPart:=1; for I := 0 to Images.Count - 1 do begin Img := TIdAttachmentfile.Create(Msg.MessageParts, Images[I]); Img.ContentDisposition := 'inline'; Img.ContentType := 'image/jpeg'; Img.ExtraHeaders.Values['Content-ID'] := ExtractFileName(Images[I]); img.ParentPart:=0; end; SMTP.AuthType := atDefault; {Simple Login} SMTP.USERname := User; SMTP.Password := Pass; SMTP.Host := Host; SMTP.Port := 25; smtp.Connect; try SMTP.Send(Msg); finally Result := True; SMTP.Disconnect; end; Msg.Free; SMTP.Free; end; |