LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices



Reply
 
Search this Thread
Old 05-24-2010, 02:07 PM   #1
mpapet
Member
 
Registered: Nov 2003
Location: Los Angeles
Distribution: debian
Posts: 453

Rep: Reputation: 46
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.
 
Old 05-24-2010, 02:26 PM   #2
spampig
Member
 
Registered: Feb 2010
Location: /Earth/UK/England/Hampshire
Distribution: Debian, Ubuntu, CentOS, Slackware
Posts: 262
Blog Entries: 2

Rep: Reputation: 56
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
 
Old 05-24-2010, 02:46 PM   #3
mpapet
Member
 
Registered: Nov 2003
Location: Los Angeles
Distribution: debian
Posts: 453

Original Poster
Rep: Reputation: 46
Perfect!
Thank you.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Slackware64 13 and BlueZ woes part 2 ... maybe issues with main.conf btncix Slackware 2 10-23-2009 02:15 AM
may server hosting different part of web site must appear as part of a domain amolgupta Linux - Software 6 07-13-2009 02:52 PM
How to prevent spoofing from Postfix/local part nihal Linux - Security 9 05-06-2009 12:10 PM
LXer: New Linux Foundation Must Be Part Lawyer, Part Peacemaker LXer Syndicated Linux News 0 01-27-2007 04:33 PM
LXer: Wells Grants in Part IBM's Motion to Limit SCO's Claims! In *Large* Part. LXer Syndicated Linux News 0 06-28-2006 10:33 PM


All times are GMT -5. The time now is 11:31 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration