Newsgroups : Borland : borland.public.delphi.internet.winsock : 2007 Apr : Indy9 SMTP

www.cryer.info
Managed Newsgroup Archive

Indy9 SMTP

Subject:Indy9 SMTP
Posted by:"Rich Davis" (richarddavis.nospamforme@acm.org)
Date:Tue, 24 Apr 2007 11:15:57

Hi,

I'm having trouble using Indy 9 to send SMTP mail. I'm using the code below:

IdSMTP.AuthenticationType := atNone;
IdMessage := TIdMessage.Create(Nil);
try
   IdMessage.From.Address := sSenderEmail;
   IdMessage.Sender.Address := sSenderEmail;
   IdMessage.ReplyTo.EMailAddresses := sSenderEmail;
   IdMessage.Recipients.EMailAddresses := sRecipientEmail;
   IdMessage.Subject := sSubject;
   IdMessage.ContentType := 'text/plain';
   IdMessage.Body.Text := sBody;
   IdSMTP.Host := sSmtpHost;
   IdSMTP.AuthenticationType := atNone;
   try
      IdSMTP.Connect(2000);
      {following line doesn't work}
      IdSMTP.SendMsg(IdMessage, False);
      {following line does work}
      IdSMTP.QuickSend(sSmtpHost, sSubject + ' - quick', sRecipientEmail,
                sSenderEmail, sBody);
   except on E:Exception do
      showmessage('ERROR: ' + E.Message);
   end;
finally
   IdSMTP.Disconnect;
   IdMessage.Free;
end;

The SendMsg method doesn't seem to work although I get no errors. The
QuickSend method OTOH does work. Unfortunately, I need to use SendMsg
because I need the additional flexibility that it gives me.

Since QuickSend works, I know I've got the correct SMTP host, but I
don't know what else the problem might be.

I'm using Delphi 7, Indy 9.00.10, on Windows XP SP2.

Thanks.
Rich

Replies:

www.cryer.info
Managed Newsgroup Archive