Board index » delphi » Trying a solution to my idsmtp problem...

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

"RAO" <XXXX@XXXXX.COM>writes
news:XXXX@XXXXX.COM...

>i've tried many things and i don't understand english correctly...
>the code is this! what is wrong?

The code is wrong.

>gambit send me a link in indy components but i don't understand
>very well... how can I change this code to see the image only in
>the HTML sended... not in attachments.

Please read the following article, it explains what is needed, and
includes
code samples:

HTML Messages
www.indyproject.org/Sockets/Blogs/RLebeau/2005_08_17_A.en.iwp


Gambit
i've tried many things and i don't understand english correctly... the code
is this! what is wrong? gambit send me a link in indy components but i don't
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;
 
 

Re:Trying a solution to my idsmtp problem...

"RAO" <XXXX@XXXXX.COM>writes
Quote
my english is so bad... which example i have to use? related,
non related? which example?, the article I have see...
Images to be displayed inside of HTML need to be "related" attachments. For
the example you showed earlier, please read the "Plain-text and HTML and
attachments" section of the article, specifically the "HTML-related
attachments only" subtopic.
Gambit
 

Re:Trying a solution to my idsmtp problem...

thanks...
"Remy Lebeau (TeamB)" <XXXX@XXXXX.COM>escreveu na mensagem
Quote

"RAO" <XXXX@XXXXX.COM>writes
news:XXXX@XXXXX.COM...

>my english is so bad... which example i have to use? related,
>non related? which example?, the article I have see...

Images to be displayed inside of HTML need to be "related" attachments.
For
the example you showed earlier, please read the "Plain-text and HTML and
attachments" section of the article, specifically the "HTML-related
attachments only" subtopic.


Gambit