Re: Problems when changing the port number of TIdSMTP

Giganews Newsgroups
Subject: Re: Problems when changing the port number of TIdSMTP
Posted by:  Remy Lebeau \(Indy Team\) (
Date: Thu, 10 Jan 2008

"HDumas" <du…> wrote in message

> Here is the code that I am having trouble with.

QuickSend() is a static class method.  It can be called via the class type
itself without using a object instance, ie:

    TIdSMTP.QuickSend(iniHostCourriel, p_Objet, p_Destinataires,
p_Expediteur, p_Text);

As such, it has to create its own TIdSMTP object instance internally.  Your
assignment to the Port property is useless because it has no chance of being
used by QuickSend().  In order to set the Port, you must use the Send()
method instead.

> 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.

Then you did not fill in the TIdMessage properties with valid data.

> Here is the code.
>  wkMessage := TIdMessage.Create(nil)
>  wkMessage.Clear;

>  wkMessage.From.Text := p_Expediteur;
>  wkMessage.Recipients.Add.Text := p_Destinataires;

What are the actual values of p_Expediteur and p_Destinataires?

>  wkMessage.Body.Add(p_text);

If p_text contains multiple lines then you need to use Text property

    wkMessage.Body.Text := p_text;

> Can anybody tell me why I cannot send an email using the port
> 5555 of the exchange server??

Because you are using QuickSend().  You must use Send() instead, and you
must ensure the TIdMessage is set up properly beforehand.




In response to

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