Next: Character translation, Up: Library [Contents][Index]
Returns the value of Sendmail macro macro. If macro is
not defined, raises the e_macroundef
exception.
Calling getmacro(name)
is completely equivalent to
referencing ${name}
, except that it allows to construct
macro names programmatically, e.g.:
if getmacro("auth_%var") = "foo" … fi
Return true if Sendmail macro name is defined.
Notice, that if your MTA supports macro name negotiation22, you will have to export macro names used by these two functions using ‘#pragma miltermacros’ construct. Consider this example:
func authcheck(string name) do string macname "auth_%name" if macro_defined(macname) if getmacro(macname) … fi fi done #pragma miltermacros envfrom auth_authen prog envfrom do authcheck("authen") done
In this case, the parser cannot deduce that the envfrom
handler
will attempt to reference the ‘auth_authen’ macro, therefore the
‘#pragma miltermacros’ is used to help it.
That is, if it supports Milter protocol 6 and
upper. Sendmail 8.14.0 and Postfix 2.6 and newer do. MeTA1 (via
pmult
) does as well. See MTA Configuration, for more
details.