178
178
# who the message was destined for. That make our job easy.
179
179
# - the message could have been originally destined for a list owner,
180
180
# but a list owner address itself bounced. That's bad, and for now
181
# we'll simply log the problem and attempt to deliver the message to
183
# - the list owner could have set listname-bounces as the owner
184
# address. That's really bad as it results in a loop of ever
181
# we'll simply attempt to deliver the message to the site list
183
# Note that this means that automated bounce processing doesn't work
184
# for the site list. Because we can't reliably tell to what address
185
# a non-VERP'd bounce was originally sent, we have to treat all
186
# bounces sent to the site list as potential list owner bounces.
187
# - the list owner could have set list-bounces (or list-admin) as the
188
# owner address. That's really bad as it results in a loop of ever
185
189
# growing unrecognized bounce messages. We detect this based on the
186
# X-BeenThere header and handle it like a list owner bounce. No
187
# real bounce will have an X-BeenThere header for the list.
188
bts = [s.strip().lower() for s in msg.get_all('x-beenthere', [])]
189
if mlist.GetListEmail().lower() in bts:
193
# All messages to list-owner@vdom.ain have their envelope sender set
194
# to site-owner@dom.ain (no virtual domain). Is this a bounce for a
195
# message to a list owner, coming to the site owner, or an owner
196
# notice sent directly to the -bounces address?
197
if msg.get('to', '') == Utils.get_site_email(extra='owner') or bt:
190
# fact that this message itself will be from the site bounces
191
# address. We then send this to the site list owner instead.
192
# Notices to list-owner have their envelope sender and From: set to
193
# the site-bounces address. Check if this is this a bounce for a
194
# message to a list owner, coming to site-bounces, or a looping
195
# message sent directly to the -bounces address. We have to do these
196
# cases separately, because sending to site-owner will reset the
198
# Is this a site list bounce?
199
if (mlist.internal_name().lower() ==
200
mm_cfg.MAILMAN_SITE_LIST.lower()):
198
201
# Send it on to the site owners, but craft the envelope sender to
199
202
# be the -loop detection address, so if /they/ bounce, we won't
200
203
# get stuck in a bounce loop.
201
204
outq.enqueue(msg, msgdata,
202
recips=[Utils.get_site_email()],
203
envsender=Utils.get_site_email(extra='loop'),
206
envsender=Utils.get_site_email(extra='loop'),
210
# Is this a possible looping message sent directly to a list-bounces
211
# address other than the site list?
212
# Check From: because unix_from might be VERP'd.
213
# Also, check the From: that Message.OwnerNotification uses.
214
if (msg.get('from') ==
215
Utils.get_site_email(mlist.host_name, 'bounces')):
216
# Just send it to the sitelist-owner address. If that bounces
217
# we'll handle it above.
218
outq.enqueue(msg, msgdata,
219
recips=[Utils.get_site_email(extra='owner')],
220
envsender=Utils.get_site_email(extra='loop'),
206
224
# List isn't doing bounce processing?
331
351
subject=_('Uncaught bounce notification'),
333
syslog('bounce', 'forwarding unrecognized, message-id: %s',
354
'%s: forwarding unrecognized, message-id: %s',
355
mlist.internal_name(),
334
356
msg.get('message-id', 'n/a'))
336
syslog('bounce', 'discarding unrecognized, message-id: %s',
359
'%s: discarding unrecognized, message-id: %s',
360
mlist.internal_name(),
337
361
msg.get('message-id', 'n/a'))