Page 1 of 1

Duplicate Emails with multiple recipients

Posted: June 24th, 2011, 5:32 pm
by jag111
Version: 0.6.5 (and 0.6.2 previously)
OS: Windows Server 2008 R2
Install-type: Windows Installer running as a windows service
Firewall Software: Windows Firewall
Are you using IPV6? No
Is the issue reproducible? Yes

This issue appears to have been reported during the 0.6 beta, but it doesn't look like it was resolved.  The thread is here: http://forums.sabnzbd.org/index.php?topic=6990.0

When specifying multiple addresses for "Email Recipient" in the Email Notification section, each recipient appears to get multiple copies of the email for however many total recipients are specified.  So if there are two comma separated addresses, each recipient gets two emails.  The To: fields in the emails appear to be correct (one addressed to each recipient), but both recipients get both copies of the email.  I'm not using any custom email templates and the "Email Templates Folder" value is empty.

The issue started when we upgraded from 0.5.6 to 0.6.2.  It has persisted through 0.6.5.  We're using authenticated Gmail as the SMTP server (smtp.gmail.com:587).  It happens both for normal Email notifications and using the "Test E-Mail" function.  The SABnzbd log file contains the following when sending a test email:

2011-06-24 15:29:15,144::INFO::[interface:2492] Sending testmail
2011-06-24 15:29:15,145::DEBUG::[emailer:59] Connecting to server smtp.gmail.com:587
2011-06-24 15:29:15,207::DEBUG::[emailer:72] Non-SSL mail server detected reconnecting to server smtp.gmail.com:587
2011-06-24 15:29:15,296::DEBUG::[emailer:86] TLS mail server detected
2011-06-24 15:29:16,914::INFO::[emailer:123] Notification e-mail succesfully sent
2011-06-24 15:29:16,917::DEBUG::[emailer:59] Connecting to server smtp.gmail.com:587
2011-06-24 15:29:16,976::DEBUG::[emailer:72] Non-SSL mail server detected reconnecting to server smtp.gmail.com:587
2011-06-24 15:29:17,063::DEBUG::[emailer:86] TLS mail server detected
2011-06-24 15:29:18,655::INFO::[emailer:123] Notification e-mail succesfully sent

It definitely appears to be something funky happening with the email headers.  Only two emails appear to be getting sent.  But it's like each recipient is BCC'd on each email.

Re: Duplicate Emails with multiple recipients

Posted: June 25th, 2011, 1:38 am
by shypike
Nobody in the team was able to reproduce the problem.
That makes it impossible to solve.
We still don't have a clue about what's going on.
I'll have another look and follow your BCC hint.

Re: Duplicate Emails with multiple recipients

Posted: June 25th, 2011, 9:44 am
by jag111
Yeah, I understand how unreproducible problems are hard to solve.  And ultimately this is more of an annoyance than a super critical bug.  I just wanted to keep the issue open and add my name to the seemingly short list of people affected.

Re: Duplicate Emails with multiple recipients

Posted: June 25th, 2011, 1:49 pm
by shypike
jag111 wrote: this is more of an annoyance
You're right that it's an annoyance.
Also for us. We actually believe people who claim this issue.
It's very frustrating when one cannot reproduce it.
Especially since I use the same setup with gmail.

Re: Duplicate Emails with multiple recipients

Posted: July 8th, 2011, 7:37 am
by zoggy
shypike wrote:
jag111 wrote: this is more of an annoyance
You're right that it's an annoyance.
Also for us. We actually believe people who claim this issue.
It's very frustrating when one cannot reproduce it.
Especially since I use the same setup with gmail.
my coworker is having this problem, he showed it to me tonight. I can provide you his sab ini / whatever you need to test. he is having gmail send out notices to 2 email addresses... both people get 2 emails... hit me up on irc and i can give you more details. I just entered in the info and tested it out myself.. I get 2 emails myself now.

Re: Duplicate Emails with multiple recipients

Posted: July 8th, 2011, 7:53 am
by shypike
I have looked at this before.
What ever I tried, I couldn't get gmail to send duplicate emails.
Even Wireshark transcripts did not shed any light on it.
You can send the INI file (remove passwords!) and also the used email templates to bugs at sabnzbd.org

Re: Duplicate Emails with multiple recipients

Posted: July 8th, 2011, 8:37 pm
by zoggy
just emailed over my config. when my coworker gets in i'll have him send over his.

Re: Duplicate Emails with multiple recipients

Posted: July 11th, 2011, 9:43 am
by viama
I am also experiencing this issue with duplicate mail using gmail smtp. I am using the stock templates.

Re: Duplicate Emails with multiple recipients

Posted: July 11th, 2011, 12:25 pm
by shypike
I can confirm that something odd is going on.
It will take some time to examine it properly.

Re: Duplicate Emails with multiple recipients

Posted: July 11th, 2011, 12:58 pm
by shypike
Nothing "odd" is going on, just a plain dumb-ass error in SABnzbd's emailing code.
SABnzbd sends an email in a separate session to each recipient, but the "to" address is always the full list of recipients.
So the email server dutifully sends the email twice to both recipients.

When testing this bug was masked because I have auto-forwarding on for almost all of my accounts.
Gmail helpfully recognizes two identical messages (the real duplicate and the forwarded copy) and shows only one.

Will be fixed in the next 0.6.6 Beta.
There's no work-around.