Subject: Re: SMTP 551 code in use?
From: John C Klensin <[email-masked]>
To: "[email-masked]" <[email-masked]>, Arnt Gulbrandsen <[email-masked]>
Cc: "[email-masked]" <[email-masked]>
Date: Tue, 25 Mar 2003 13:29:49 -0500
List-Id: <ietf-smtp.imc.org>

--On Monday, 24 March, 2003 11:46 -0500 
"[email-masked]" <[email-masked]> wrote:

> On Mon, 24 Mar 2003 15:02:26 +0100, Arnt Gulbrandsen
> <[email-masked]>  said:
>> when I (acting as SMTP client) send rcpt to and receive a 551
>> code from  a server, it might be a good idea to use the
>> referenced e-mail address  instread of the one I used. Final
>> decision left to the user, of course.
>
> I'm not clear what you mean by "referenced address instead of
> the one I used"?
>
> RFC2821, section 4.2.2:
>
>       551 User not local; please try <forward-path>
>
> Pretty clear that the server is supposed to give you a
> forward-path that is usable in a RCPT TO: (if the 551 reply is
> supported at all, some sites may disable it due to the
> inherent information leakage).
>...
>    When normal (2yz or 551) responses are returned from a VRFY
> or EXPN    request, the reply normally includes the mailbox
> name, i.e.,    "<local-part@domain>", where "domain" is a
> fully qualified domain    name, MUST appear in the syntax.  In
> circumstances exceptional enough    to justify violating the
>...
> This seems to indicate that your parser should look for a
> regexp of the form "<lhs@rhs>", with possibly other text
> before or after.

Yep.
     john

From: Arnt Gulbrandsen <[email-masked]>
To: [email-masked]
Subject: Re: SMTP 551 code in use?
Cc: [email-masked]
Date: Mon, 24 Mar 2003 18:32:06 +0100
Sender: [email-masked]

[email-masked] writes:
> On Mon, 24 Mar 2003 15:02:26 +0100, Arnt Gulbrandsen 
> <[email-masked]>  said:
>>  when I (acting as SMTP client) send rcpt to and receive a 551 code 
>>  from a server, it might be a good idea to use the referenced e-mail 
>>  address instread of the one I used. Final decision left to the 
>>  user, of course.
>
> I'm not clear what you mean by "referenced address instead of the one 
> I used"?

I used one address in the RCPT TO command. Another address is referenced 
by the 551 reply.

> RFC2821, section 4.2.2:
>
>       551 User not local; please try <forward-path>

Exactly. I don't see any formal grammar for the bit after 551.

> RFC2821, section 3.5.2:
...
> This seems to indicate that your parser should look for a regexp of 
> the form "<lhs@rhs>", with possibly other text before or after.

Regexps smell bad, say I. ;)

I guess I'll look for "<" local-part "@" domain ">" and if I don't find 
exactly one occurence of that, or if I see loose @, < or > characters 
anywhere else, I'll bail out and pretend I received a 550.

Thanks.

--Arnt

To: Arnt Gulbrandsen <[email-masked]>
Cc: [email-masked]
Subject: Re: SMTP 551 code in use? 
From: [email-masked]
Date: Mon, 24 Mar 2003 11:46:16 -0500
Sender: [email-masked]

--==_Exmh_504863270P
Content-Type: text/plain; charset=us-ascii

On Mon, 24 Mar 2003 15:02:26 +0100, Arnt Gulbrandsen <[email-masked]>  said:
> when I (acting as SMTP client) send rcpt to and receive a 551 code from 
> a server, it might be a good idea to use the referenced e-mail address 
> instread of the one I used. Final decision left to the user, of course.

I'm not clear what you mean by "referenced address instead of the one I used"?

RFC2821, section 4.2.2:

      551 User not local; please try <forward-path>

Pretty clear that the server is supposed to give you a forward-path that
is usable in a RCPT TO: (if the 551 reply is supported at all, some sites
may disable it due to the inherent information leakage).

So what happens is:

VRFY [email-masked]
551 User not local; please try <[email-masked]>

> However, I can't find any formal grammar for the text supplied by 551. 
> Is there one? Can I expect server implementations to conform to this 
> well-hidden grammar (assuming there are server implementations that 
> return 551 at all)?

RFC2821, section 3.5.2:

   When normal (2yz or 551) responses are returned from a VRFY or EXPN
   request, the reply normally includes the mailbox name, i.e.,
   "<local-part@domain>", where "domain" is a fully qualified domain
   name, MUST appear in the syntax.  In circumstances exceptional enough
   to justify violating the intent of this specification, free-form text
   MAY be returned.  In order to facilitate parsing by both computers
   and people, addresses SHOULD appear in pointed brackets.  When
   addresses, rather than free-form debugging information, are returned,
   EXPN and VRFY MUST return only valid domain addresses that are usable
   in SMTP RCPT commands.  Consequently, if an address implies delivery
   to a program or other system, the mailbox name used to reach that
   target MUST be given.  Paths (explicit source routes) MUST NOT be
   returned by VRFY or EXPN.

This seems to indicate that your parser should look for a regexp of the form
"<lhs@rhs>", with possibly other text before or after.

-- 
				Valdis Kletnieks
				Computer Systems Senior Engineer
				Virginia Tech

--==_Exmh_504863270P
Content-Type: application/pgp-signature

--==_Exmh_504863270P--

From: Arnt Gulbrandsen <[email-masked]>
To: [email-masked]
Subject: SMTP 551 code in use?
Date: Mon, 24 Mar 2003 15:02:26 +0100
Sender: [email-masked]

Hi,

when I (acting as SMTP client) send rcpt to and receive a 551 code from 
a server, it might be a good idea to use the referenced e-mail address 
instread of the one I used. Final decision left to the user, of course.

However, I can't find any formal grammar for the text supplied by 551. 
Is there one? Can I expect server implementations to conform to this 
well-hidden grammar (assuming there are server implementations that 
return 551 at all)?

--Arnt