Re: Problems when changing the port number of TIdSMTP

Giganews Newsgroups
Subject: Re: Problems when changing the port number of TIdSMTP
Posted by:  HDumas (du…@hotmail.com)
Date: Thu, 10 Jan 2008

Hi,

I decided to take the demos found on the website and found that the IdSMTP
component had zero(0) as the value of the ReadTimeOut property... and in my
application there was a 5 in the property value (I don't know why!)... but
now it works... and why it gave an Invalid Address error?? I still don't
know.  But it works and that's the main thing.

H. Dumas

"HDumas" <du…@hotmail.com> a écrit dans le message de news:
7EDD9A7A3344E340du…@hotmail.com...
> Hello,
>
> I have Delphi 7 and the Indy components that come with it. I need to send
> an email, using our exchange server.
> Here is the code that I am having trouble with.
>
>  wkSMTP := TIdSMTP.Create(nil);
>  wkSMTP.Port := 5555;
>  wkSMTP.QuickSend(iniHostCourriel, p_Objet, p_Destinataires, p_Expediteur,
> p_Text);
>  FreeAndNil(wkSMTP);
>
> Although I changed the port number, it stills try to send through port
> 25...
> To make sure that I could connect to this other port, I tried the
> following code.(I put a breakpoint on the Connect line so that I could
> have time to verify on our exchange server that I am connected)
>
>  wkSMTP := TIdSMTP.Create(nil);
>  wkSMTP.Port := 5555;
>  wkSMTP.Connect();
>  FreeAndNil(wkSMTP);
>
> Then I create a TIDmessage and when I try to do the send, it gives me an
> EIdProtocolReplyError with a message 5.5.4 Invalid Address.  Here is the
> code.
>  wkMessage := TIdMessage.Create(nil)
>  wkMessage.Clear;
>  wkMessage.From.Text := p_Expediteur;
>  wkMessage.Recipients.Add.Text := p_Destinataires;
>  wkMessage.Subject := p_Objet;
>  wkMessage.Body.Add(p_text);
>  wkSMTP := TIdSMTP.Create(nil);
>  wkSMTP.Port := 5555;
>  wkSMTP.Connect();
>  try
>    wkSMTP.Send(wkMessage);
>  finally
>    wkSMTP.Disconnect;
>  end;
>
> When I go to see the log on the exchange server, I has a line to show that
> there has been a connection to the port 5555... there are 3 lines
> EHLO-250
> MAIL-250
> QUIT-240
> But if not specifiying the port 5555 and keeping it on the port 25...
> everything works fine and in the log, it shows this
> EHLO-250
> MAIL-250
> RECP-250
> DATA-250
> QUIT-240
>
> Can anybody tell me why I cannot send an email using the port 5555 of the
> exchange server??  Thank you for any help or hints you can give me.
>
> H. Dumas

Replies

In response to

Problems when changing the port number of TIdSMTP posted by HDumas on Thu, 10 Jan 2008