Email command results are incorrect for confirm emails when list is set to confirm + moderate
When a list is set to confirm email and moderate subscriptions the email command results from replying to the confirm email are incorrect.
- Results:
Confirmation token did not match
- Unprocessed:
b'Re: confirm 02f01e61fe5d9eaea975bc2894ba307e9c01a199'
- Done.
In the above example the authorization email was sent to the list owner and following approval the user was successfully subscribed.
commands/eml_confirm.py doesn't handle the case of the subscription needing approval by a moderator.
Potential patch:
diff -Naur a/commands/eml_confirm.py b/commands/eml_confirm.py
--- a/commands/eml_confirm.py 2015-05-23 17:22:27.463456000 +0100
+++ b/commands/eml_confirm.py 2015-05-23 18:35:46.379456000 +0100
@@ -69,5 +69,8 @@
if succeeded:
print(_('Confirmed'), file=results)
return ContinueProcessing.yes
+ if token_owner is TokenOwner.moderator:
+ print(_('Pending moderator approval'), file=results)
+ return ContinueProcessing.no
print(_('Confirmation token did not match'), file=results)
return ContinueProcessing.no
Whilst the above fixes the Results: section. The Unprocessed section will still be unchanged. Investigation has revealed that for the processing of the email, two commands are passed for processing. One for the verp confirm address and one from the subject. Thus the second one is still pending when ContinueProcessing.no is invoked.
I've worked around it with this patch to ignore subject and body for sub-address specific emails:
diff -Naur a/runners/command.py b/runners/command.py
--- a/runners/command.py 2015-05-23 17:22:27.419456000 +0100
+++ b/runners/command.py 2015-05-23 19:24:39.383456000 +0100
@@ -63,12 +63,15 @@
subaddress = msgdata.get('subaddress')
if subaddress == 'join':
self.command_lines.append('join')
+ return
elif subaddress == 'leave':
self.command_lines.append('leave')
+ return
elif subaddress == 'confirm':
mo = re.match(config.mta.verp_confirm_regexp, msg.get('to', ''))
if mo:
self.command_lines.append('confirm ' + mo.group('cookie'))
+ return
# Extract the subject header and do RFC 2047 decoding.
raw_subject = msg.get('subject', '')
try:
Not sure if this is the best option? Would you expect additional commands needing to be processed for emails sent to specific sub-address?