I am noticing Discourse sends email 2 times when a user signs up or gets a private message etc.
I can recreate this when I sign up a new user. I don’t know how can I troubleshoot this or what’s the exact problem or if this could be a problem of my e-mail server… I found some similar topics but they are couple of years old so I wanted to open a new topic.
Do you see any information in your site’s Sent Emails logs related to these emails? Note that you can use the inputs at the top of that page to filter emails by User, To Address, or Email Type:
Though one strange thing happened. With the protonmail.com domain it didn’t send a double but with anonaddy.com there is a double e-mail. This makes me think maybe this issue is tied back to the mail server not Discourse.
Although I get double emails from my own domain/mail server as well. Can we trust that the email is not shown in the sent page then it’s %100 Discourse is not sending double e-mail?
Okay it looks like both are coming from Discourse then if I got it right:
First mail:
Return-Path: <SRS0=ll8P=FH=anonaddy.com=b_na4w2nlvmv3gizdenmya_gq4wmodfhfrwm@Mail Server>
Delivered-To: Email Address
Received: from mail2.anonaddy.me (mail2.anonaddy.me [***.***.***.***])
by Mail Server (Postfix) with ESMTPS id A9132370DA
for Email Address; Sat, 23 Sep 2023 11:06:42 +0300 (+03)
Received: from mail2.anonaddy.me (mail2.anonaddy.me [127.0.0.1])
by mail2.anonaddy.me (Postfix) with ESMTPS id 64958FA584
for Email Address; Sat, 23 Sep 2023 09:06:41 +0100 (BST)
DKIM-Signature: [Truncated]
From: [Sender]
To: Email Address
Subject: =?utf-8?Q?=5BBilin=C3=A7li?= Teknoloji
=?utf-8?Q?T=C3=BCketicileri=5D_Hesab=C4=B1n=C4=B1z=C4=B1_ona?=
=?utf-8?Q?ylaman=C4=B1z_i=C3=A7in_an=C4=B1msat=C4=B1c=C4=B1?=
Feedback-ID: F:28f5e9fd-7ba5-4466-8b17-b52f087bd332:anonaddy
Message-ID: [Message ID]
Received: from Mail Server ([***.***.***.***]) by
mail2.anonaddy.me (Postfix) with ESMTPS id 70F86100233 for
Email Address; Sat, 23 Sep 2023 09:06:37 +0100 (BST)
Second Mail (same, double, you can see they are apart by seconds):
Return-Path: <SRS0=mdkr=FH=anonaddy.com=b_payts6dtgn5dkodznftq_my3tgntdgvqwk@Mail Server>
Delivered-To: Email Address
Received: from mail2.anonaddy.me (mail2.anonaddy.me [***.***.***.***])
by Mail Server (Postfix) with ESMTPS id D2066370DA
for Email Address; Sat, 23 Sep 2023 11:06:54 +0300 (+03)
Received: from mail2.anonaddy.me (mail2.anonaddy.me [127.0.0.1])
by mail2.anonaddy.me (Postfix) with ESMTPS id 68CBC107D41
for Email Address; Sat, 23 Sep 2023 09:06:54 +0100 (BST)
DKIM-Signature: [Truncated]
From: [Sender]
To: Email Address
Subject: =?utf-8?Q?=5BBilin=C3=A7li?= Teknoloji
=?utf-8?Q?T=C3=BCketicileri=5D_Hesab=C4=B1n=C4=B1z=C4=B1_ona?=
=?utf-8?Q?ylaman=C4=B1z_i=C3=A7in_an=C4=B1msat=C4=B1c=C4=B1?=
Feedback-ID: F:28f5e9fd-7ba5-4466-8b17-b52f087bd332:anonaddy
Message-ID: [Message ID]
Received: from Mail Server ([***.***.***.***]) by
mail2.anonaddy.me (Postfix) with ESMTPS id E34B6100233 for
Email Address; Sat, 23 Sep 2023 09:06:51 +0100 (BST)
Next check Mail Server’s logs to find out if Discourse sent one message vs. two and what’s the history for the email that hit anonaddy’s mail servers as 70F86100233 and E34B6100233.
First one is: Message-ID: <6172c966-5777-44c2-988f-6acdd7ff33ff@btt.community>
Second one is: Message-ID: <70297dae-5cb7-467b-980d-ef6dcfeea220@btt.community>
I checked out my mail server logs like this: cat mail.log | grep 70297dae
I guess Claudia can’t find that information. Any other suggestions on how can we pinpoint and fix the issue would be appreciated because I am clueless. Thank you.
I once was struggling with a similar behavior. Users got hammered with emails, which the mail server sent but in discourse’s view were not sent.
My hypothesis was that it is possible that discourse gives a job to the mail server and there is a timeout during the process, which causes this to look like a fail to discourse even though the mail was sent. The failed job is then repeated and results in a new mail.
I was happy to resolve this by killing jobs in sidekiq, restarting the mail server and tinkering with fail2ban rules.