Discourse recognizing a bounced email but not updating user bounce score

I’m seeing many emails which are bouncing back (hard bounces), discourse is able to parse them and recognize that they’re bouncing but it doesn’t seem be incrementing the user bounce score.

The specific discourse configuration can be seen here : Bounced emails not being detected - #8 by RBoy

Here are the error logs showing that discourse is able to parse the bounced email and recognize that it’s a bounced email.

Email can not be processed: Email::Receiver::BouncedEmailError

Delivered-To: xxx.discourse@gmail.com
Received: by 2002:a05::f96 with SMTP id bs17csp1115046dlb;
        Thu, 25 Jan 2024 12:03:33 -0800 (PST)
X-Google-Smtp-Source: AGHT+IEagzW8QOUgAyfOxU9wYaox/wuiL/wNqWhvftUB4uO/85r9H/55+FnfT6NrSTkLI5kfj+Vy
X-Received: by 2002:a05::9265 with SMTP id br34-20020a05620a462200b007838ba09265mr280168qkb.773013398;
        Thu, 25 Jan 2024 12:03:33 -0800 (PST)
Return-Path: <>
Received: from mx.owl.com (mx.owl.com. [c.c.c.c])
        by mx.google.com with ESMTPS id bi4-20020a05620a318400b00783c84e9ef8si590747qkb.206.203
        for <xxx.discourse@gmail.com>
        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
        Thu, 25 Jan 2024 12:03:33 -0800 (PST)
Received-SPF: none (google.com: mx.owl.com does not designate permitted sender hosts) client-ip=b.b.b.b;
Authentication-Results: mx.google.com;
       dkim=pass header.i=@xtra.co.nz header.s=alpha header.b=biFVvXep;
       arc=fail (signature failed);
       spf=none (google.com: mx.owl.com does not designate permitted sender hosts) smtp.helo=mx.owl.com;
       dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=xtra.co.nz
Received: from out230.xtra.co.nz (out230.xtra.co.nz [a.a.a.a])
	by mx.owl.com (Postfix) with ESMTP id 4DD662748E3
	for <discourse@xxx.com>; Thu, 25 Jan 2024 20:03:28 +0000 (UTC)
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=xxx.com;
	s=dkim; t=1706213008;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 dkim-signature; bh=2Zs6sc12mj9NdzMbMndHL1G/d2rfnpzwQPL9OvhR4us=;
	b=04YQ47fVOyeAWE29mDWSvHSnhIF6OHoiWUmo8hMVcDT3zRMcbUKzPTQgb+fGtC+s3bSpx2
	jmCT+pADtTIMq8XvC/nxFItxvYZzU9ZAokFXOQmdS6mDhrbLQu3ZlNqml7Pr92jCGOS90y
	...

Here’s the original bounced email that discourse processed

Delivered-To: xxx.discourse@gmail.com
Received: by 2002:a05:7022:911:b0:73:def8:f96 with SMTP id bs17csp1115046dlb;
        Thu, 25 Jan 2024 12:03:33 -0800 (PST)
X-Google-Smtp-Source: AGHT+IEagzW8QOUgAyfOxU9wYaox/wuiL/wNqWhvftUB4uO/85r9H/55+FnfT6NrSTkLI5kfj+Vy
X-Received: by 2002:a05:620a:4622:b0:783:8ba0:9265 with SMTP id br34-20020a05620a462200b007838ba09265mr280168qkb.77.1706213013398;
        Thu, 25 Jan 2024 12:03:33 -0800 (PST)
Return-Path: <>
Received: from mx.owl.com (mx.owl.com. [a.a.a.a])
        by mx.google.com with ESMTPS id bi4-20020a05620a318400b00783c84e9ef8si590747qkb.206.202aaa
        for <xxx.discourse@gmail.com>
        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
        Thu, 25 Jan 2024 12:03:33 -0800 (PST)
Received-SPF: none (google.com: mx.owl.com does not designate permitted sender hosts) client-ip=b.b.b.b;
Authentication-Results: mx.google.com;
       dkim=pass header.i=@xtra.co.nz header.s=alpha header.b=biFVvXep;
       arc=fail (signature failed);
       spf=none (google.com: mx.owl.com does not designate permitted sender hosts) smtp.helo=mx.owl.com;
       dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=xtra.co.nz
Received: from out2306.xtra.co.nz (out2306.xtra.co.nz [c.c.c.c]) by mx.owl.com (Postfix) with ESMTP id 4DD662748E3 for <discourse@xxx.com>; Thu, 25 Jan 2024 20:03:28 +0000 (UTC)
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=xxx.com; s=dkim; t=1706213008; h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 dkim-signature; bh=2Zs6sc12mj9NdzMbMndHL1G/d2rfnpzwQPL9OvhR4us=; b=04YQ47fVOyeAWE29mDWSvHSnhIF6OHoiWUmo8hMVcDT3zRMcbUKzPTQgb+fGtC+s3bSpx2 jmCT+pADtTIMq8XvC/nxFItxvYZzU9ZAokFXOQmdS6mDhrbLQu3ZlNqml7Pr92jCGOS90y dRgSsZFyD0WUnMWd0fe3YYoQyD/eu1E=
ARC-Seal: i=1; s=dkim; d=xxx.com; t=1706213008; a=rsa-sha256; cv=none; b=obmEhisqbMgrD2qMRBRcFuNf1smxnDjQUTziHgWROSF0D2bs9Zh0ozC9Uoxa+ZVS6St6at QB3FRXnDhhrOpCY1aNjgjPGw/a40lVHt9l/tiDqKGULbqc8J1QANIz2BEyyRFl8VDPQ2HS 96tjCFXONIu6e7/jAc3UjxnBTGfcdJs=
ARC-Authentication-Results: i=1; mx.owl.com; dkim=pass header.d=xtra.co.nz header.s=alpha header.b=biFVvXep; dmarc=pass (policy=none) header.from=xtra.co.nz; spf=pass (mx.owl.com: domain of out2306.xtra.co.nz designates b.b.b.b as permitted sender) smtp.helo=out2306.xtra.co.nz
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xtra.co.nz; s=alpha; t=1706213003; bh=2Zs6sc12mj9NdzMbMndHL1G/d2rfnpzwQPL9OvhR4us=; h=From:To:Subject:Message-ID:Date; b=biFVvXep8gMvadN2UPbaFpoEF0zo0GGfqjohYIDHkj2d2AlI2/ZpeRvw+Z559rhO2
	 ax/azAzDKKpemyY3Tbaa6ashxVBlXLZ7niH0uM2AM8wlsoHgbBNGIz887WP5B3jxLf
	 VmcKIoHpuJPSDpMQZlMvoYNJUntAYyM7xqNnza9Y=
SMX-Results: classifications=clean
SMX-S1C: gggruggvucftvghtrhhoucdtuddrgedvkedrvdelhedggedtucetufdoteggodetrfdotffvucfrrh hofhhilhgvmecuuffoigenuceurghilhhouhhtmecufedttdenucfpohhtihhfihgtrghtihhonhcu lddutddttddtmdenucfjughrpefhvffukfggtgffsehptderredttddtnecuhfhrohhmpeforghilh cuffgvlhhivhgvrhihucfuhihsthgvmhcuoehpohhsthhmrghsthgvrhesgihtrhgrrdgtohdrnhii qeenucggtffrrghtthgvrhhnpeettdeuvedutdfhleeifffgfeeftedvjedtleffleefheehtefhue duueffffdtvdenucfkphepuddtrddvfedrfedtrdehheenucevlhhushhtvghrufhiiigvpedvtden ucfrrghrrghmpehinhgvthepuddtrddvfedrfedtrdehhedpnhgspghrtghpthhtohepuddprhgtph htthhopeguihhstghushhsihhonhesmhgtvggsuhguugihvdigrdgtohhmpdhmohguvgepshhmthhp ohhuthdpshhpfhepnhhonhgvpdhhvghlohepihhnthgvrhhnrghlpdfovfetjfhoshhtpehmthgrvd eftdeh
SMX-S1V: bounce
SMX-S1S: 10000
Received: from internal ([d.d.d.d]) by xtra.co.nz with ESMTP id 65B2BE8B-8BFD145D@mta2305.int; Thu, 25 Jan 2024 20:03:23 +0000
Received: from [127.0.0.1] ([local]) by xtra.co.nz (envelope-from <>) (ecelerity 4.4.1.20033 r(msys-ecelerity:tags/4.4.1.0^0)) with INTERNAL id 51/02-27675-B8EB2B56; Thu, 25 Jan 2024 20:03:23 +0000
From: Mail Delivery System <postmaster@xtra.co.nz>
To: discourse@xxx.com
Subject: Mail Delivery Failure: [XXX Name] Summary
Message-ID: <51.02.2675.B8EB2B56@xtra.co.nz>
MIME-Version: 1.0
Content-Type: multipart/report; report-type=delivery-status; boundary="KYOxV05EDzCFldCZzAqTSKT0Lr8BZO9lW97+Qw=="
Date: Thu, 25 Jan 2024 20:03:23 +0000

--KYOxV05EDzCFldCZzAqTSKT0Lr8BZO9lW97+Qw==
Content-Type: text/plain

This message was created automatically by the mail system (ecelerity).

A message that you sent could not be delivered to one or more of its
recipients. This is a permanent error. The following address(es) failed:

>>> yyy@zzz.net.nz (while not connected): 554 5.4.7 [internal] exceeded max time without delivery

--KYOxV05EDzCFldCZzAqTSKT0Lr8BZO9lW97+Qw==
Content-Type: message/delivery-status


--KYOxV05EDzCFldCZzAqTSKT0Lr8BZO9lW97+Qw==
Content-Type: text/rfc822-headers
Content-Disposition: inline

------ This is a copy of the headers of the original message. ------

DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xtra.co.nz; s=alpha;
	t=1706126603; bh=wYNtZUhfijcS7c/A+qRcfwzLOCXyPSrY1CFR2uMAMfM=;
	h=Date:From:Reply-To:To:Message-ID:Subject;
	b=S/sbf5VdmfVk6EknSvg8df0xvly9M+R6atw8GGAm2KIeqX5Dk3YrWhzB4T1+8zzYZ
	 TJnNciaiqS+kE6zX+Nw+2ia6TGrF2NzhdLS2+ZjwCydeQstpL1U5nEo5SoWkXHxc6z
	 Pbiw37EzXDDeCOZz32UUOFXFxqQfkXTTqQz06+eI=
SMX-Results: classifications=clean
Received: from internal ([d.d.d.d]) by xtra.co.nz with ESMTP
	id 65B16D0B-75CF173F@mta2305.int;
	Wed, 24 Jan 2024 20:03:23 +0000
SMX-S1C: gggruggvucftvghtrhhoucdtuddrgedvkedrvdeluddguddvlecutefuodetggdotefrodftvfcurf
	hrohhfihhlvgemucfuofginecuuegrihhlohhuthemuceftddtnecundfotefknffkpffiucdludej
	mdenucfjughrpeffhfhrvffkufggtgfgjfesrgejreertddtjeenucfhrhhomhepofevgfeuuhguug
	ihuceoughishgtuhhsshhiohhnsehmtggvsghuugguhidvgidrtghomheqnecuggftrfgrthhtvghr
	nheplefgjeefgffgkefgtdettdduledvtdfhfeejgfduheffheelteeuueffffdtgeeunecuffhomh
	grihhnpehmtggvsghuugguhidvgidrtghomhenucfkphepfeegrdduleefrdefhedrudefgedpfeeg
	rddvfedurddvgeekrddugeegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvth
	epfeegrdduleefrdefhedrudefgedpmhgrihhlfhhrohhmpeguihhstghushhsihhonhesmhgtvggs
	uhguugihvdigrdgtohhmpdhnsggprhgtphhtthhopedupdhrtghpthhtohepjhhohhhnrdhlvghkse
	igthhrrgdrtghordhniidpshhpfhepphgrshhspdgukhhimhepphgrshhspdgumhgrrhgtpehprghs
	shdphhgvlhhopehmtggvsghuugguhidvgidrtghomhdpoffvtefjohhsthepmhhtrgdvfedthe
SMX-S1V: commercial:mce
SMX-S1S: 17
Authentication-Results: mx.xtra.co.nz;
    dmarc=pass (p=none dis=pass) header.from=xxx.com;
    dkim=pass header.i=@xxx.com header.s=dkim header.d=xxx.com;
    spf=pass smtp.mailfrom=xxx.com
Received: from xxx.com ([a.a.a.a]) by mx.xtra.co.nz with ESMTP
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256
	(128/128 bits)) id 65B16D06-40160058@mta2305;
	Wed, 24 Jan 2024 20:03:20 +0000
dkim-signature: v=1; a=rsa-sha256; d=xxx.com; s=dkim;
	c=relaxed/relaxed; q=dns/txt; h=From:Reply-To:Subject:Date:Message-ID:To:MIME-Version:Content-Type:Content-Transfer-Encoding:List-Unsubscribe;
	bh=/ZS9hqygevMko/XMMJ0YgGxKcbBw5r9/DMCM73aq9Kg=;
	b=C/zBPI6G24eC4akyA2SnHoz8XeSPDE5S0mCRiNWWA+qhJpByjhKIyZHVr5vbcb3GZvOkD28raDolsMe7rzsAfnmR/HWia/aVx8NXVsxSmD2+Uzk4FQQQ8fmHAWjOKtYE18POWF6LIinvoqT+Q8TdOmsIzes6pmjfw7iJTHezl/k=
Received: from localhost.localdomain (xxx.com [z.z.z.z])
	by xxx.com with ESMTPSA
	(version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256)
	; Wed, 24 Jan 2024 15:02:52 -0500
Date: Wed, 24 Jan 2024 20:02:47 +0000
From: XXX Name <discourse@xxx.com>
Reply-To: XXX Name <discourse@xxx.com>
To: yyy.zzz@xtra.co.nz
Message-ID: <5c24b412-0b2f-438e-b0a9-3584517b25a7@discourse.xxx.com>
Subject: [XXX Name] Summary
Mime-Version: 1.0
Content-Type: multipart/alternative;
 boundary="--==_mimepart_65b16ce6b2c53_2952f7d811914e";
 charset=UTF-8
Content-Transfer-Encoding: 7bit
List-Unsubscribe: <https://discourse.xxx.com/email/unsubscribe/3057956e32e3da13c9abd5fdf8a1d6ef64432a8901864d27a07d6071876fbf76>
X-Auto-Response-Suppress: All
Auto-Submitted: auto-generated



--KYOxV05EDzCFldCZzAqTSKT0Lr8BZO9lW97+Qw==--

This was an example of the weekly summary email that bounced.

Now I understand that due to the lack of a {reply_key} discourse isn’t able to tie the email to a specific topic (does a weekly summary email even have a topic id?), however discourse is able to parse the bounced email and recognize the original recipient email address which bounced.
Therefore, it should therefore increment the bounce score for that user and then eventually stop sending emails to that user.

1 Like

There are loads of emails like this which bounce back are recognized but then not tied back to the user.

Here’s the backtrace

/var/www/discourse/lib/email/processor.rb:183:in `log_email_process_failure' 
/var/www/discourse/lib/email/processor.rb:42:in `handle_bounce' 
/var/www/discourse/lib/email/processor.rb:27:in `rescue in process!' 
/var/www/discourse/lib/email/processor.rb:16:in `process!' 
/var/www/discourse/lib/email/processor.rb:13:in `process!' 
/var/www/discourse/app/jobs/scheduled/poll_mailbox.rb:29:in `process_popmail' 
/var/www/discourse/app/jobs/scheduled/poll_mailbox.rb:49:in `block (2 levels) in poll_pop3' 
net-pop-0.1.2/lib/net/pop.rb:669:in `each' 
net-pop-0.1.2/lib/net/pop.rb:669:in `each_mail' 
/var/www/discourse/app/jobs/scheduled/poll_mailbox.rb:46:in `block in poll_pop3' 
net-pop-0.1.2/lib/net/pop.rb:531:in `start' 
/var/www/discourse/app/jobs/scheduled/poll_mailbox.rb:45:in `poll_pop3' 
/var/www/discourse/app/jobs/scheduled/poll_mailbox.rb:14:in `execute' 
/var/www/discourse/app/jobs/base.rb:292:in `block (2 levels) in perform' 
rails_multisite-5.0.0/lib/rails_multisite/connection_management.rb:82:in `with_connection'
/var/www/discourse/app/jobs/base.rb:279:in `block in perform' 
/var/www/discourse/app/jobs/base.rb:275:in `each' 
/var/www/discourse/app/jobs/base.rb:275:in `perform' 
/var/www/discourse/app/jobs/base.rb:346:in `perform' 
mini_scheduler-0.16.0/lib/mini_scheduler/manager.rb:122:in `process_queue' 
mini_scheduler-0.16.0/lib/mini_scheduler/manager.rb:70:in `worker_loop' 
mini_scheduler-0.16.0/lib/mini_scheduler/manager.rb:59:in `block (2 levels) in ensure_worker_threads' 
1 Like