Lmtp2nntp - 437 "References" header too long

From Perswiki
Jump to: navigation, search

For years I have been using "lmtp2nntp" to feed mails to innd, the news server daemon. I am subscribed to many many mailing lists, and these I direct to each their own newsgroup. This enables me to use a newsreader such as knode which is much more comfortable.

However, occasionally mails have been rejected by innd with "437 "References" header too long". I have never really looked any further into it until today, when I first discovered a) what it really means and b) how to fix it.

The References header being too long simply means it is longer than 980 (or thereabouts, I don't know the exact limit) characters. It is in fact perfectly valid for this header to be that long or even much longer, but innd disagrees and rejects the mail. Sometimes this has led to me being unsubscribed by overly sensitive mailing list managers. A References header may easily grow quite long, for instance when a mailing list thread goes on and on.

Fixing it is easily done in "/etc/news/lmtp2nntp.conf" or wherever you've put your lmtp2nntp config file:

headerrule    '700:^(References):$1:${msg.header.${1}[0]:s/([^ ]+ +)//g}'

This deletes every message-id with trailing blanks, i.e. all except the last one. That is sufficient to "attach" the mail to the right thread.