익명 04:51

Sendmail support of empty group addresses (AKA list syntax)

Sendmail support of empty group addresses (AKA list syntax)

E-mail group addresses such as undisclosed-recipients:; or a group:<[email protected]>,<[email protected]>; are valid forms of addressing according to RFC 5322, see for instance the illustrative example in Appendix A.1.3. In Sendmail, this is called "list syntax". Minimal working example (for Bash):

echo "Date: $(date --rfc-2822)
From: <[email protected]>
To: a group:<[email protected]>,<[email protected]>;
" | sendmail -t

However, trying to submit messages with empty groups leads to error List:; syntax illegal for recipient addresses. Minimal example:

echo "Date: $(date --rfc-2822)
From: <[email protected]>
To: undisclosed-recipients:;
Bcc: [email protected]
" | sendmail -t

returns

undisclosed-recipients:;... List:; syntax illegal for recipient addresses

How can Sendmail be configured to support empty RFC 5322 group addresses when submitting messages via sendmail -t?



Top Answer/Comment:

After looking at Sendmail's source code my conclusion is that in order to have Sendmail support (or rather ignore) empty groups properly a change of the source code is required.

Empty group addresses such as To: foo:; should simply be ignored just like To: (foo) or To: or '' (i.e. nothing). By debugging I found that this is not an issue with submit.cf. Cf rules are never applied to empty addresses. In parseaddr.c, parseaddr->prescan returns NULL for empty addresses, but not for :;. This can be shown by submitting messages to sendmail -t -d20.1.

Workarounds are:

  • Use (foo) instead of foo:;
  • Use "impudent"(*) rewriting + discarding as shown by user at in phpBB: List:; syntax illegal for recipient addresses (code not tested)

(*) quoting the original author

상단 광고의 [X] 버튼을 누르면 내용이 보입니다