Postfix - Virtualmin - Server error: '501 5.1.3 Bad recipient address syntax' - due to outlook tags <> invalid email format ?
A user of my mail server recently had some recipients of a message returned.
He received this message from my server.
The following recipient(s) cannot be reached:
'redacted@civ.utoronto.ca' on 8/20/2014 10:35 AM
Server error: '501 5.1.3 Bad recipient address syntax'
'redacted@wlu.ca' on 8/20/2014 10:35 AM
Server error: '501 5.1.3 Bad recipient address syntax'
'redacted@uoguelph.ca' on 8/20/2014 10:35 AM
Server error: '501 5.1.3 Bad recipient address syntax'
'redacted@uoguelph.ca' on 8/20/2014 10:35 AM
Server error: '501 5.1.3 Bad recipient address syntax'
'redacted@eng.uwo.ca' on 8/20/2014 10:35 AM
Server error: '501 5.1.3 Bad recipient address syntax'
The other recipients were delivered successfully. On the server-side, Postfix logged:
Aug 20 14:35:17 darwin postfix/smtpd[63431]: warning: Illegal address syntax from
or087.uwaterloo.ca[129.97.9.53] in RCPT command: <'redacted@uwo.ca'>
Aug 20 14:35:17 darwin postfix/smtpd[63431]: warning: Illegal address syntax from
or087.uwaterloo.ca[129.97.9.53] in RCPT command: <'redacted@wlu.ca'>
Aug 20 14:35:17 darwin postfix/smtpd[63431]: warning: Illegal address syntax from
or087.uwaterloo.ca[129.97.9.53] in RCPT command: <'redacted@eng.uwo.ca'>
Aug 20 14:35:17 darwin postfix/smtpd[63431]: warning: Illegal address syntax from
or087.uwaterloo.ca[129.97.9.53] in RCPT command: <'redacted@grandriver.ca'>
The problem is that these particular addresses were literally enclosed by apostrophes.
I don't know why the user's client (Outlook) misformatted these addresses.
He confirmed that he did not copy them from another application or change anything at his end.
To fix the problem I configured Postfix to filter and rewrite the address when it is sending commands to other MTAs.
I added to main.cf:
# Strange filtering
smtpd_command_filter = pcre:/usr/local/etc/postfix/command_filter
and created the file command_filter:
# Fix malformed emails that are surrounded in single quotes.
/^RCPT\s+TO:\s*<'([^[:space:]]+)'>(.*)/ RCPT TO:<$1>$2
This fixed this oddity in which RCPT TO commands were not RFC 821-compliant.
Hint for others: on my Debian machine I had to install the package "postfix-pcre" to enable PCRE maps with Postfix.
Your answer
Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!
Keep Informed
About This Forum
This forum is for HiTechnologia Employees & just Odoo general knowledge purpose only.
Read GuidelinesQuestion tools
Stats
Asked: 10/25/15, 9:06 AM |
Seen: 4232 times |
Last updated: 10/25/15, 9:07 AM |