Re: 550 Response problem

Giganews Newsgroups
Subject: Re: 550 Response problem
Posted by:  Remy Lebeau (TeamB) (no.spam@no.spam.com)
Date: Wed, 22 Feb 2006

"Alister Christie" <alist…@salespartner.co.nz> wrote in message
news:C82D49DF37EEE240alist…@salespartner.co.nz...

> I've upgraded from Indy 9 to Indy 10

Which version of Indy 10 specifically?

> the smtp server (in this case smtp.xtra.co.nz) on
> InvalidEmailAddre…@xtra.co.nz gives a 550 response
> (invalid mail box) to this address and Indy throws an
> exception.

Sounds like you are not using the TIdSMTP's OnFailedRecipient event.  If you
do not assign a handler to that event, then TIdSMTP will throw an exception
on the first 550 error that it receives.  Inside the event handler, you can
set the VContinue parameter to True to ignore rejected addresses, and
TIdSMTP will then only throw the exception if all of the addresses were
rejected.

> This was fine under Indy 9

Not true.  Indy 9 always threw an exception whenever an address was
rejected.

> however now that I have upgraded to indy 10 vali…@xtra.co.nz recieves a
blank email.

I doubt that.  Whenever the server reports an error while receiving a
message, TIdSMTP automatically resets the state of the connection, which
means that the server discards the message and does not deliver it.

> My code is effectively

I would suggest putting the Disconnect() into a try..finally block:

    try
        IdSMTP1.Connect;
        try
            IdSMTP1.Send(myIdMessage);
        finally
            IdSMTP1.Disconnect;
        end;
        Result := True;
    except
        fEmailSender.Close;
        raise;
    end;

> I'm getting around the problem currently by making 550 an accecptable
> response in IdSMTPBase.pas
>    RCPTTO_ACCEPT : array [0..2] of SmallInt = (250, 251, 550);

You should not be doing that at all.  550 is a real error.  You should not
be forcing TIdSMTP to treat it as a successful operation.  The fact that you
are doing that suggests to me that you are using an old version of Indy 10
where the OnFailedRecipient event did not exist yet.  In which case, you
should consider upgrading to the latest 10.1.5 development snapshot.

Gambit

Replies

In response to

550 Response problem posted by Alister Christie on Wed, 22 Feb 2006