Postfix : BUG FIX : warning: Illegal address syntax ( Fix malformed emails )

Basically the sending email client is outlook and the existing contact email address in the address book contains an apostrophe this can cause the emails address to become invalid.

Assumptions

postfix 2.7 or later

Description:

Fix malformed emails that are surrounded in single quotes.

BUG:

Jun 22 08:25:14 mx-a postfix/smtpd[15460]: warning: Illegal address syntax from server.emaildomain.com[xxx.xxx.xxx.xxx] in RCPT command: <"Brian (brian@emailserver.com)"@your.emailserver.com>

FIX:

Run the following to create the /etc/postfix/command_filter.regex file

cat > /etc/postfix/command_filter.regex <<EOF
# eXtremeSHOK.com

# Fix Illegal address syntax, malformed emails that are surrounded in single quotes
/^RCPT\s+TO:\s*<'([^[:space:]]+)'>(.*)/ RCPT TO:<\$1>\$2

EOF

Add the following to your /etc/postfix/main.cf

# Fix for Illegal address syntax
smtpd_command_filter = pcre:/etc/postfix/command_filter.regex

Reload your postfix

service postfix reload

 

You may also like...