LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (http://www.linuxquestions.org/questions/linux-server-73/)
-   -   Postfix main.cf local part and domain part variables? (http://www.linuxquestions.org/questions/linux-server-73/postfix-main-cf-local-part-and-domain-part-variables-809835/)

mpapet 05-24-2010 02:07 PM

Postfix main.cf local part and domain part variables?
 
Hi,

I'm trying to figure out how to access the local part and the domain part of an email address in postfix's main.cf.

For example, myname@mydomain.net has myname as the local part and mydomain.net as the domain part. I get the whole email address with %s. I want to speed up the lookups by writing better database queries.

I've had no luck finding this in the otherwise well documented postfix.

Thanks in advance.

spampig 05-24-2010 02:26 PM

Take a look at this (around the MYSQL PARAMETERS) http://www.postfix.org/mysql_table.5.html

Quote:

This parameter supports the following '%' expan-
sions:

%% This is replaced by a literal '%' character.

%s This is replaced by the input key. SQL
quoting is used to make sure that the input
key does not add unexpected metacharacters.

%u When the input key is an address of the form
user@domain, %u is replaced by the SQL
quoted local part of the address. Other-
wise, %u is replaced by the entire search
string. If the localpart is empty, the
query is suppressed and returns no results.

%d When the input key is an address of the form
user@domain, %d is replaced by the SQL
quoted domain part of the address. Other-
wise, the query is suppressed and returns no
results.

%[SUD] The upper-case equivalents of the above
expansions behave in the query parameter
identically to their lower-case counter-
parts. With the result_format parameter
(see below), they expand the input key
rather than the result value.

%[1-9] The patterns %1, %2, ... %9 are replaced by
the corresponding most significant component
of the input key's domain. If the input key
is user@mail.example.com, then %1 is com, %2
is example and %3 is mail. If the input key
is unqualified or does not have enough
domain components to satisfy all the speci-
fied patterns, the query is suppressed and...
HTH

mpapet 05-24-2010 02:46 PM

Perfect!
Thank you.


All times are GMT -5. The time now is 11:47 AM.