Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Special character in email ID

71 views
Skip to first unread message

Justin

unread,
Nov 15, 2011, 3:48:53 PM11/15/11
to
New to postfix please bare with us. :)

We like to accept special characters in email id so surrounding the  email names with "", but still these emails are sent to fallback maildir.

Followed this man page --> http://www.postfix.org/aliases.5.html
The name is a local address (no domain part).  Use  double quotes  when the name contains any special characters such
as whitespace, `#', `:', or `@'. The  name  is  folded  to lowercase, in order to make database lookups case insensi- tive.


E.g., $first...@box.com, &tes...@mail.com, #te...@ju.com

Wrapped them as "$firstemail"@box.com, "&testem"@mail.com, "#test"@ju.com as well    "$first...@box.com"  - but no use.

Hmm...any thing else need to take care of ???


postfix version 2.4

postconf -n

alias_maps = pgsql:/etc/postfix.myd/dl.exp.pgsql, pgsql:/etc/postfix.myd/pdl.pgsql, regexp:/etc/postfix.myd/empty.dl.regexp
alternate_config_directories = /etc/postfix.myd /etc/postfix.dropbox /etc/postfix.out /etc/postfix.forward /etc/postfix.active /etc/postfix.fallback
bounce_queue_lifetime = 3d
bounce_template_file = /etc/postfix.myd/bounce.cf
command_directory = /usr/sbin
config_directory = /etc/postfix.myd
daemon_directory = /usr/libexec/postfix
default_destination_concurrency_limit = 50
default_destination_recipient_limit = 100
default_process_limit = 500
fast_flush_domains = hash:/etc/postfix.myd/nexthop.transport
header_address_token_limit = 160000
header_size_limit = 1048576
home_mailbox = Maildir/
mail_owner = postfix
mailbox_size_limit = 0
mailbox_transport = virtual
manpage_directory = /usr/local/man
maximal_queue_lifetime = 30d
message_size_limit = 1048576000
mydestination =
mydomain = qa.myorg.com
myhostname = bobby.qa.myorg.com
mynetworks = xxxxxx.xxxx
myorigin = $myhostname
notify_classes = resource,software
proxy_interfaces = xxxxxx.xxxx
queue_directory = /var/spool/postfix.myd
readme_directory = /etc/postfix.myd
relay_domains =
relayhost = 127.0.0.1:10037
sample_directory = /etc/postfix.myd
sender_dependent_relayhost_maps = hash:/etc/postfix.myd/active_user.relay
sendmail_path = /usr/sbin/sendmail
setgid_group = postdrop
smtp_connect_timeout = 10s
smtp_destination_recipient_limit = $default_destination_recipient_limit
smtp_tls_CAfile = /etc/postfix.myd/certs/ca-bundle.crt
smtp_tls_cert_file = /etc/postfix.myd/certs/server.crt
smtp_tls_key_file = /etc/postfix.myd/certs/server.key
smtp_tls_loglevel = 1
smtp_tls_per_site = hash:/etc/postfix/tls_per_site, static:MAY
smtp_tls_session_cache_timeout = 3600s
smtpd_etrn_restrictions = permit_mynetworks, reject
syslog_name = postfix-myd
transport_maps = regexp:/etc/postfix.myd/myd.transport.regexp, hash:/etc/postfix.myd/vp.transport, hash:/etc/postfix.myd/active.transport, hash:/etc/postfix.myd/fallback.transport, hash:/etc/postfix.myd/external.transport
unknown_local_recipient_reject_code = 450
virtual_alias_maps = regexp:/etc/postfix.myd/my_domain_aliases.regexp, hash:/etc/postfix.myd/virtual_users, hash:/etc/postfix.myd/virtual_dlists, hash:/etc/postfix.myd/dropboxes, regexp:/etc/postfix.myd/dropboxes.subdomains.regexp, regexp:/etc/postfix.myd/unrewrite.regexp
virtual_gid_maps = static:10219
virtual_mailbox_base = /myd
virtual_mailbox_domains = mail.dir d.list pd.list
virtual_mailbox_limit = 1048576000
virtual_mailbox_maps = regexp:/etc/postfix/virtual_mailbox.regexp
virtual_minimum_uid = 10000
virtual_transport = virtual
virtual_uid_maps = static:10219


Brian Evans - Postfix List

unread,
Nov 15, 2011, 3:58:27 PM11/15/11
to
On 11/15/2011 3:48 PM, Justin wrote:
> New to postfix please bare with us. :)
>
> We like to accept special characters in email id so surrounding the
> email names with "", but still these emails are sent to fallback maildir.
>
> Followed this man page --> http://www.postfix.org/aliases.5.html
> The name is a local address (no domain part). Use double quotes
> when the name contains any special characters such
You missed this valuable part of this line "(no domain part)"

> as whitespace, `#', `:', or `@'. The name is folded to lowercase,
> in order to make database lookups case insensi- tive.
>
>
> E.g., $first...@box.com <mailto:first...@box.com>,
> &tes...@mail.com <mailto:tes...@mail.com>, #te...@ju.com
> <mailto:te...@ju.com>
>
> Wrapped them as "$firstemail"@box.com, "&testem"@mail.com,
> "#test"@ju.com as well "$first...@box.com" - but no use.
Aliases allows "$firstemail" or "&testem" or "#test". You MUST NOT
include the domain part.

As always, aliases(5) maps are only used for those users that are
delivered by the local(8) delivery agent.

Brian

Justin

unread,
Nov 15, 2011, 5:14:04 PM11/15/11
to
Brian, Thanks for the reply.

We have put quotes surrounded the mail name part only excluded the domain and made sure that main.cf has
resolve_dequoted_address as yes

We receive email from external sources and postfix forwards to our local mail store, here is the value of
"virtual_alias_maps" in main.cf

virtual_alias_maps = regexp:/etc/postfix.myd/my_domain_aliases.regexp, hash:/etc/postfix.myd/virtual_users, hash:/etc/postfix.myd/virtual_dlists, hash:/etc/postfix.myd/dropboxes, regexp:/etc/postfix.myd/dropboxes.subdomains.regexp, regexp:/etc/postfix.myd/unrewrite.regexp

Sample virtual_users fragment
"#critica...@mydomain.com"   ms23/007/000/002/106/@mail.dir
"#critica...@mydomain.another.com"  ms23/007/000/002/106/@mail.dir

postmap creates virtual_users.db file using virtual_users and uses for lookup.

My perception is during the lookup it is not able to resolve the email to corresponding maildir, hence routing to fallback maildir rather than bouncing it back.(we don't want it to get bounce that part is fine).

Please let me know for more info.


From: Brian Evans - Postfix List <grkn...@scent-team.com>
To: postfi...@postfix.org
Sent: Tuesday, November 15, 2011 2:58 PM
Subject: Re: Special character in email ID

Jeroen Geilman

unread,
Nov 15, 2011, 5:18:20 PM11/15/11
to
On 2011-11-15 23:14, Justin wrote:
Brian, Thanks for the reply.

We have put quotes surrounded the mail name part only excluded the domain and made sure that main.cf has
resolve_dequoted_address as yes

We receive email from external sources and postfix forwards to our local mail store, here is the value of
"virtual_alias_maps" in main.cf

virtual_alias_maps = regexp:/etc/postfix.myd/my_domain_aliases.regexp, hash:/etc/postfix.myd/virtual_users, hash:/etc/postfix.myd/virtual_dlists, hash:/etc/postfix.myd/dropboxes, regexp:/etc/postfix.myd/dropboxes.subdomains.regexp, regexp:/etc/postfix.myd/unrewrite.regexp

Sample virtual_users fragment

postmap creates virtual_users.db file using virtual_users and uses for lookup.

There is no reference to virtual_users in the above virtual_alias_maps.

I think you are confusing virtual_alias_maps and virtual_mailbox_maps; this is not uncommon.

For a virtual address to be delivered to a virtual mailbox, the domain in question must be present in virtual_mailbox_domains AND the address must resolve to a mailbox in virtual_mailbox_maps.

Use

    postmap -q "query" maptype:/map/location

to validate your maps.

-- 
J.

Justin

unread,
Nov 15, 2011, 5:36:37 PM11/15/11
to
Thanks a lot, mean while i will validate using postmap command,i assume the bold text is the reference ??

virtual_alias_maps = regexp:/etc/postfix.myd/my_domain_aliases.regexp, hash:/etc/postfix.myd/virtual_users, hash:/etc/postfix.myd/virtual_dlists, hash:/etc/postfix.myd/dropboxes, regexp:/etc/postfix.myd/dropboxes.subdomains.regexp, regexp:/etc/postfix.myd/unrewrite.regexp


From: Jeroen Geilman <jer...@adaptr.nl>
To: postfi...@postfix.org
Sent: Tuesday, November 15, 2011 4:18 PM

Subject: Re: Special character in email ID

Jeroen Geilman

unread,
Nov 15, 2011, 5:38:38 PM11/15/11
to
On 2011-11-15 23:36, Justin wrote:
Thanks a lot, mean while i will validate using postmap command,i assume the bold text is the reference ??

Yes, it is; it was buried beneath the irrelevance.

As I said before, virtual_alias_maps does not concern virtual *mailboxes*.
-- 
J.

Justin

unread,
Nov 15, 2011, 6:03:50 PM11/15/11
to
postconf -n gave the following

virtual_mailbox_maps = regexp:/etc/postfix/v_m_box.regexp

Content is
if /@mail\.dir$/
/^(.*)@mail\.dir$/ $1
endif

i guess this may confirm the mailbox a valid one.

Any other info do i need to look into?

TIA

From: Jeroen Geilman <jer...@adaptr.nl>
To: postfi...@postfix.org
Sent: Tuesday, November 15, 2011 4:38 PM

Jeroen Geilman

unread,
Nov 15, 2011, 6:16:25 PM11/15/11
to
On 2011-11-16 00:03, Justin wrote:
postconf -n gave the following

virtual_mailbox_maps = regexp:/etc/postfix/v_m_box.regexp

Content is
if /@mail\.dir$/
/^(.*)@mail\.dir$/ $1
endif

i guess this may confirm the mailbox a valid one.

Any other info do i need to look into?

I am not sure what the question is.

The observed behaviour corresponds with the configuration; if that is not what you intended, we will need more specific details on what you did intend.


-- 
J.

Justin

unread,
Nov 15, 2011, 6:20:32 PM11/15/11
to
Thank Jeroen.

I have executed the postmap command against the virtual_users, when i issue

postmap -q test...@mydomain.com /etc/postfix/virtual_users it gives me the corresponding maildir value but when i say

postmap -q #critica...@mydomain.com /etc/postfix/virtual_users  --- syntax wrong

postmap -q "#critica...@mydomain.com" /etc/postfix/virtual_users  --- no result

postmap -q ""#critica...@mydomain.com"" /etc/postfix/virtual_users  --- no result


Now the question boils down to how to give escape characters in this case to query the map??


Here is my sample virtual_users fragment
test...@mydomain.com   ms11/007/000/002/108/@mail.dir

Jeroen Geilman

unread,
Nov 15, 2011, 6:29:20 PM11/15/11
to
On 2011-11-16 00:20, Justin wrote:
Thank Jeroen.

I have executed the postmap command against the virtual_users, when i issue

postmap -q test...@mydomain.com /etc/postfix/virtual_users it gives me the corresponding maildir value

No, it does not - since this is a virtual ALIAS map, and not a mailbox map.


but when i say

postmap -q #critica...@mydomain.com /etc/postfix/virtual_users  --- syntax wrong

You'd need to quote the address localpart, as per the RFC.



postmap -q "#critica...@mydomain.com" /etc/postfix/virtual_users  --- no result

Meaning no match was found.



postmap -q ""#critica...@mydomain.com"" /etc/postfix/virtual_users  --- no result

Meaning no match was found.




Now the question boils down to how to give escape characters in this case to query the map??

The first example - double qoutes - will work fine.

I am still unclear what it is you want to achieve with all this; it is difficult to advise you to do anything until you explain this.


-- 
J.

Justin

unread,
Nov 15, 2011, 6:38:42 PM11/15/11
to
I apologize i have not included what are all combinations i have tried....none worked, all i'm trying to do is
if the key has '#' in it how you query using postmap.



[root@myserv~]# postmap -q "#criticalemail1"@mydomain.com /etc/postfix/virtual_users

[root@myserv~]# postmap -q "##criticalemail1"@mydomain.com /etc/postfix/virtual_users

[root@myserv~]# postmap -q ""#criticalemail1""@mydomain.com /etc/postfix/virtual_users

[root@myserv~]# postmap -q #critica...@mydomain.com /etc/postfix/virtual_users
postmap: option requires an argument -- q
postmap: fatal: usage: postmap [-Nfinoprsvw] [-c config_dir] [-d key] [-q key] [map_type:]file...

[root@myserv~]# postmap -q "#"critica...@mydomain.com /etc/postfix/virtual_users
postmap: warning: database /etc/postfix/virtual_users.db is older than source file /etc/postfix/virtual_users

[root@myserv~]# postmap -q "#"critica...@mydomain.com /etc/postfix/virtual_users
postmap: warning: database /etc/postfix/virtual_users.db is older than source file /etc/postfix/virtual_users

[root@myserv~]# postmap /etc/postfix/virtual_users

[root@myserv~]# postmap -q "#"critica...@mydomain.com /etc/postfix/virtual_users

[root@myserv~]# postmap -q #critica...@mydomain.com /etc/postfix/virtual_users
postmap: option requires an argument -- q
postmap: fatal: usage: postmap [-Nfinoprsvw] [-c config_dir] [-d key] [-q key] [map_type:]file...

[root@myserv~]# postmap -q ""#criticalemail1""@mydomain.com /etc/postfix/virtual_users


Here is my sample virtual_users fragment

From: Jeroen Geilman <jer...@adaptr.nl>
To: postfi...@postfix.org
Sent: Tuesday, November 15, 2011 5:29 PM

Subject: Re: Special character in email ID

Justin

unread,
Nov 16, 2011, 10:43:28 AM11/16/11
to
Any one ?

If virtual_users contains the following entry, what will be the postmap query to retrieve the value pair?

I know postfix is RFC822 compliant as well this email ID, so i'm confident some genius will come up with a
suitable query to retrieve the value.


virtual_users
postmap -q test...@mydomain.com /etc/postfix/virtual_users  --- works perfect.


Thanks a million in advance.

From: Justin <justi...@yahoo.com>
To: Jeroen Geilman <jer...@adaptr.nl>; "postfi...@postfix.org" <postfi...@postfix.org>
Sent: Tuesday, November 15, 2011 5:38 PM
0 new messages