Board index » delphi » mail to send with attachment

mail to send with attachment

hi all

i'm using indy8.008 & D5 for an application webmodule.
for send a mail i'm coding like this in a procedure :

StUserId:= t_user.FieldByName('User_mail_login').AsString;
StPassword:= t_user.FieldByName('User_mail_mdp').AsString;
StSmtp:= t_user.FieldByName('User_smtp').AsString;
InPortSmtp                      := 25;
SMTP1.Host                      := StSmtp;
SMTP1.Port                      := InPortSmtp;
SMTP1.UserID            := StUserId;
SMTP1.Password  := StPassword;

MsgEnvoi1.Clear;

MsgEnvoi1.IsEncoded:= True;
MsgEnvoi1.ContentType:= 'text/plain; charset=iso-8859-1';
MsgEnvoi1.Date:= now;
MsgEnvoi1.From.Address:= t_user.FieldByName('User_email').AsString;
MsgEnvoi1.CCList.EMailAddresses :=
Request.ContentFields.Values['mail_cc'];

MsgEnvoi1.Subject:= Request.ContentFields.Values['mail_objet'];
MsgEnvoi1.Body.Text:= Request.ContentFields.Values['mail_body'];

// attach
if fileexist(filename) then
TIdAttachment.Create(MsgEnvoi1.MessageParts, FileName);

MsgEnvoi1.Recipients.EMailAddresses :=
Request.ContentFields.Values['destinataire'];
SMTP1.Connect;
SMTP1.Send(MsgEnvoi1);

but if i not have attachment no problem the mail is sending
if i have an attachment the mail never send.

is somebody can help me because i don't know where is my error

thanks for your help

 

Re:mail to send with attachment


Quote
>but if i not have attachment no problem the mail is sending
>if i have an attachment the mail never send.

What happens?
--
Hadi Hariri
http://delphi.urusoft.com

Re:mail to send with attachment


hi,

when i want to send a mail with attachment,
but if i not have attachment no problem the mail is sending
if i have an attachment the mail never send.

thanks

Re:mail to send with attachment


patrick.de...@libertyboard.com (Pat) wrote in <3a1405a6.21930989
@forums.inprise.com>:

Quote
>hi,

>when i want to send a mail with attachment,
>but if i not have attachment no problem the mail is sending
>if i have an attachment the mail never send.

>thanks

I mean what happens? Is there an error? It blocks? What?

--
Hadi Hariri
http://delphi.urusoft.com

Other Threads