1

Please bear with me as I'm not an expert admin

I have a linux mail server that has been running for a couple of years and now all of a sudden a certain user is unable to send emails. They immediately get a response from "System Administrator" saying

501 5.5.4 error bad notify parameter syntax

This only happens for this user and only on their computer. It works fine in Thunderbird but not in Outlook 2013. Other users can use Outlook 2013 with no problem.

I watched the log and this is what it says when this user attempts to send email

replacing command "RCPT TO: <myemail@gmail.com> NOTIFY=SUCCESS,FAILURE,DELAY" with "RCPT TO: <myemail@gmail.com> NOTIFY=SUCCESS,FAILURE,DELAY NOTIFY=NEVER"

I've checked for any Outlook rules that could be adding headers, disabled email virus scanner, re-added account, etc.

I've been reading and it appears that NOTIFY=NEVER can not be mixed with any other NOTIFY commands

I have a smtpd_command_filter setup like this

/^(RCPT\s+TO:<.*>.*)\s+NOTIFY=\S+(.*)/ $1 NOTIFY=NEVER$2
/^(RCPT\s+TO:.*)/                    $1 NOTIFY=NEVER

I'm not good with regular expressions but I'm guessing it's not parsing the original command correctly and is adding NOTIFY=NEVER to the end instead of replacing it.

In the meantime I have commented that out, which sends a "your message has been sucessfully delivered" notice back to the sender. I silenced that by adding

smtpd_discard_ehlo_keywords = silent-discard, dsn

to main.cf

Are my new settings okay or do I need to fix the original problem, which I'm guessing is in the regular expression? Any ideas?

sysadmin1138
  • 133,124
  • 18
  • 176
  • 300
Russell
  • 13
  • 4

1 Answers1

1

I've been reading and it appears that NOTIFY=NEVER can not be mixed with any other NOTIFY commands

For reference, it defined in RFC 1891 Section 5.1

A RCPT command issued by a client may contain the optional esmtp-keyword "NOTIFY", to specify the conditions under which the SMTP server should generate DSNs for that recipient. If the NOTIFY esmtp-keyword is used, it MUST have an associated esmtp-value, formatted according to the following rules, using the ABNF of RFC 822:

notify-esmtp-value = "NEVER" / 1#notify-list-element

notify-list-element = "SUCCESS" / "FAILURE" / "DELAY"

Notes:

a. Multiple notify-list-elements, separated by commas, MAY appear in a NOTIFY parameter; however, the NEVER keyword MUST appear by itself.

b. Any of the keywords NEVER, SUCCESS, FAILURE, or DELAY may be spelled in any combination of upper and lower case letters.


This is your regex (looks like copied from this page)

/^(RCPT\s+TO:<.*>.*)\s+NOTIFY=\S+(.*)/ $1 NOTIFY=NEVER$2
/^(RCPT\s+TO:.*)/                    $1 NOTIFY=NEVER

This is RCPT command string from Outlook 2013

RCPT TO: <myemail@gmail.com> NOTIFY=SUCCESS,FAILURE,DELAY

Above string will match the second line. Why? Because between TO: and <myemail@gmail.com>, there whitespace. Your first line of regex doesn't contain whitespace between TO: and '<`.

For space between ':' and '<' problem, here what RFC 5321 says

Since it has been a common source of errors, it is worth noting that spaces are not permitted on either side of the colon following FROM in the MAIL command or TO in the RCPT command. The syntax is exactly as given above.

So, that's why the problem appear locally. Looks like outlook still adding space between after RCPT TO: thus violation RFC spec.

Regex Solution:

Modify the first line of regex, so it become this

/^(RCPT\s+TO:\s*<.*>.*)\s+NOTIFY=\S+(.*)/ $1 NOTIFY=NEVER$2

adding \s* will match string which have zero or more whitespace after RCPT TO:

For explanation how regex works, visit this page.

masegaloeh
  • 18,236
  • 10
  • 57
  • 106