[Raw Msg Headers][Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: routing mail using orcpt parameter?



> Sorry to bother everyone with this stupid question without
> checking the manual first. Does anyone know how to make
> Zmailer route mail according to the ORCPT instead of the
> RCPT parameter for mail coming from specific hosts? (This
> is for routing ddns.org mail.) Thanks in advance.

Good heavens, no!

While the ORCPT content might be tempting thing to use for
routing, it can be stripped away at any moment in case the
message has gone thru a server, which does not support DSN.
(And ZMailer violates - slightly - the spirit of ORCPT by
 generating it in smtpserver (and "sendmail") in case it does
 not exist in input.)

That said, you would propably be happy with a router builtin
function which picks and decodes ORCPT parameter xtext content,
and returns that as a string ?

The first problem is to find the attribute which has the DSN data,
and then to pick ORCPT parameter value -- and to decode it.


I suggest you do it, if you want to have it.
See how  libsh/builtins.c: sh_get() does finding named
variable, and then named field.

In theory you want something like this:

pickorcpt (attrvarname) {
    local DSN, dd
    DSN="$(get $attrvarname DSN)" || return 1 # return if no DSN field
    # Split the DSN field
    for dd in $DSN
    do
	ssift "$dd" in
	ORCPT=(.*)
		return "\1"  # "rfc822;xtextvalue"
		;;
	tfiss
    done
    # Have DSN attribute component, but no ORCPT in it..
    return 1
}

In practice you want something written in C and capable to decode xtext,
and able to pick both "ORCPT=" and "orcpt=" tag-names within DSN attribute.
(In case the input happens to be in lower-case, or mixed case, or ..)

> Ambrose C. Li   <acli@mingpaoxpress.com>  +1-416-321-0088

/Matti Aarnio <mea@nic.funet.fi>