freebsd-ports/mail/mailman/files/postfix-verp.diff
Xin LI 8e046e4a7a Teach mailman how to utilize postfix's XVERP functionality,
which drastically improves mail delivery performance when
VERP is being used.

In order to exploit the performance gain, one has to choose
'POSTFIX' in the OPTIONS menu, configure postfix with proper
smtpd_authorized_verp_clients settings, then add:

	VERP_STYLE = 'Postfix'

to the mm_cfg.py configuration.

The Postfix style XVERP delivery is disabled by default.

PR:		ports/116847
Approved by:	maintainer timeout
2007-10-22 21:26:49 +00:00

51 lines
2.3 KiB
Diff

--- Mailman/Handlers/SMTPDirect.py.orig 2005-12-31 02:50:08.000000000 +0800
+++ Mailman/Handlers/SMTPDirect.py 2007-10-03 08:12:39.402049123 +0800
@@ -64,11 +64,11 @@
self.__conn.connect(mm_cfg.SMTPHOST, mm_cfg.SMTPPORT)
self.__numsessions = mm_cfg.SMTP_MAX_SESSIONS_PER_CONNECTION
- def sendmail(self, envsender, recips, msgtext):
+ def sendmail(self, envsender, recips, msgtext, mailopts=[]):
if self.__conn is None:
self.__connect()
try:
- results = self.__conn.sendmail(envsender, recips, msgtext)
+ results = self.__conn.sendmail(envsender, recips, msgtext, mailopts)
except smtplib.SMTPException:
# For safety, close this connection. The next send attempt will
# automatically re-open it. Pass the exception on up.
@@ -114,7 +114,7 @@
# recipients they'll swallow in a single transaction.
deliveryfunc = None
if (not msgdata.has_key('personalize') or msgdata['personalize']) and (
- msgdata.get('verp') or mlist.personalize):
+ (msgdata.get('verp') and mm_cfg.VERP_STYLE == 'Manual') or mlist.personalize):
chunks = [[recip] for recip in recips]
msgdata['personalize'] = 1
deliveryfunc = verpdeliver
@@ -357,8 +357,14 @@
# Errors-To while new ones will at worst ignore the header.
del msg['sender']
del msg['errors-to']
- msg['Sender'] = envsender
- msg['Errors-To'] = envsender
+ mailopts=[]
+ if msgdata.get('verp') and mm_cfg.VERP_STYLE == 'Postfix':
+ mailopts.append('XVERP=' + mm_cfg.POSTFIX_XVERP_OPTS)
+ else:
+ # these get left out of VERPed messages so they don't accidently
+ # override the VERP header.
+ msg['Sender'] = envsender
+ msg['Errors-To'] = envsender
# Get the plain, flattened text of the message, sans unixfrom
msgtext = msg.as_string()
refused = {}
@@ -366,7 +372,7 @@
msgid = msg['message-id']
try:
# Send the message
- refused = conn.sendmail(envsender, recips, msgtext)
+ refused = conn.sendmail(envsender, recips, msgtext, mailopts)
except smtplib.SMTPRecipientsRefused, e:
syslog('smtp-failure', 'All recipients refused: %s, msgid: %s',
e, msgid)