#18582 closed Uncategorized (invalid)
Emails not being sent to bcc addresses
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Core (Mail) | Version: | 1.4 |
Severity: | Normal | Keywords: | bcc, mail |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
First things first: this is the first bug I report, so please excuse me and point me in the right direction if I'm making something wrong.
Now, to the bug. Sending an email with both EmailMessage and EmailMultiAlternatives to BCC addresses fails.
I've tried this on my development machine (Archlinux), on a fresh Kubuntu 12.04 virtualbox install and on a Webfaction server, both with the default IMAP backend and the Console backend, with Python 2.7 and both Django 1.3 and 1.4 installed both on fresh virtualenvs and then removed and installed as system packages.
I experience this problem on several big proyects as well as on fresh project with just a view.
This is the simplest code test I've make and it's output to the Console backend:
views.py:
from django.core.mail import EmailMessage, EmailMultiAlternatives from django.http import HttpResponse def index(request): msg = EmailMessage( subject='test', to=['me@example.org'], bcc=['nowhere@example.org'], body='test' ) msg.send() msg = EmailMultiAlternatives( subject='test', to=['me@example.org'], bcc=['nowhere@example.org'], body='test' ) msg.send() return HttpResponse("Testing...")
Output for both Django 1.4 and 1.3, notice how bcc doesn't appear:
Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: test From: webmaster@localhost To: me@example.org Date: Fri, 06 Jul 2012 12:26:54 -0000 Message-ID: <20120706122654.9417.52070@i5-750> test ------------------------------------------------------------------------------- Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: test From: webmaster@localhost To: me@example.org Date: Fri, 06 Jul 2012 12:26:54 -0000 Message-ID: <20120706122654.9417.77135@i5-750> test ------------------------------------------------------------------------------- [06/Jul/2012 07:26:54] "GET / HTTP/1.1" 200 10
This is the output of the MTA from webfaction's log:
Jul 5 11:15:56 mail6 postfix/smtpd[24001]: 1A216210E8AE: client=web317.webfaction.com[85.17.23.88], sasl_method=CRAM-MD5, sasl_username=batlles@smtp.webfaction.com Jul 5 11:15:56 mail6 postfix/cleanup[23507]: 1A216210E8AE: message-id=<20120705161555.19081.91290@web317.webfaction.com> Jul 5 11:15:56 mail6 postfix/qmgr[3022]: 1A216210E8AE: from=<direccion@cremaycosmeticanatural.es>, size=1416, nrcpt=1 (queue active) Jul 5 11:16:26 mail6 postfix/smtp[23745]: 1A216210E8AE: to=<test@example.org>, relay=none, delay=30, delays=0.39/0/30/0, dsn=4.4.1, status=deferred (connect to example.org[192.0.43.10]: Connection timed out) Jul 5 11:46:05 mail6 postfix/qmgr[3022]: 1A216210E8AE: from=<direccion@cremaycosmeticanatural.es>, size=1416, nrcpt=1 (queue active) Jul 5 11:47:00 mail6 postfix/smtp[25697]: 1A216210E8AE: to=<test@example.org>, relay=none, delay=1864, delays=1809/25/30/0, dsn=4.4.1, status=deferred (connect to example.org[192.0.43.10]: Connection timed out) Jul 5 12:19:22 mail6 postfix/qmgr[3022]: 1A216210E8AE: from=<direccion@cremaycosmeticanatural.es>, size=1416, nrcpt=1 (queue active) Jul 5 12:20:02 mail6 postfix/smtp[27946]: 1A216210E8AE: to=<test@example.org>, relay=none, delay=3847, delays=3806/10/30/0, dsn=4.4.1, status=deferred (connect to example.org[192.0.43.10]: Connection timed out) Jul 5 13:26:00 mail6 postfix/qmgr[3022]: 1A216210E8AE: from=<direccion@cremaycosmeticanatural.es>, size=1416, nrcpt=1 (queue active) Jul 5 13:27:00 mail6 postfix/smtp[4785]: 1A216210E8AE: to=<test@example.org>, relay=none, delay=7864, delays=7804/30/30/0, dsn=4.4.1, status=deferred (connect to example.org[192.0.43.10]: Connection timed out) Jul 5 14:49:20 mail6 postfix/qmgr[3022]: 1A216210E8AE: from=<direccion@cremaycosmeticanatural.es>, size=1416, nrcpt=1 (queue active) Jul 5 14:50:08 mail6 postfix/smtp[16526]: 1A216210E8AE: to=<test@example.org>, relay=none, delay=12853, delays=12804/18/30/0, dsn=4.4.1, status=deferred (connect to example.org[192.0.43.10]: Connection timed out) Jul 5 16:12:40 mail6 postfix/qmgr[3022]: 1A216210E8AE: from=<direccion@cremaycosmeticanatural.es>, size=1416, nrcpt=1 (queue active) Jul 5 16:13:40 mail6 postfix/smtp[23562]: 1A216210E8AE: to=<test@example.org>, relay=none, delay=17864, delays=17804/30/30/0, dsn=4.4.1, status=deferred (connect to example.org[192.0.43.10]: Connection timed out) Jul 5 17:36:00 mail6 postfix/qmgr[3022]: 1A216210E8AE: from=<direccion@cremaycosmeticanatural.es>, size=1416, nrcpt=1 (queue active) Jul 5 17:37:00 mail6 postfix/smtp[2988]: 1A216210E8AE: to=<test@example.org>, relay=none, delay=22864, delays=22804/30/30/0, dsn=4.4.1, status=deferred (connect to example.org[192.0.43.10]: Connection timed out) Jul 5 18:59:20 mail6 postfix/qmgr[3022]: 1A216210E8AE: from=<direccion@cremaycosmeticanatural.es>, size=1416, nrcpt=1 (queue active) Jul 5 19:00:11 mail6 postfix/smtp[11827]: 1A216210E8AE: to=<test@example.org>, relay=none, delay=27856, delays=27804/30/21/0, dsn=4.4.1, status=deferred (connect to example.org[192.0.43.10]: Connection refused) Jul 5 20:22:42 mail6 postfix/qmgr[3022]: 1A216210E8AE: from=<direccion@cremaycosmeticanatural.es>, size=1416, nrcpt=1 (queue active) Jul 5 20:23:41 mail6 postfix/smtp[18908]: 1A216210E8AE: to=<test@example.org>, relay=none, delay=32865, delays=32806/28/30/0, dsn=4.4.1, status=deferred (connect to example.org[192.0.43.10]: Connection timed out) Jul 5 21:46:00 mail6 postfix/qmgr[3022]: 1A216210E8AE: from=<direccion@cremaycosmeticanatural.es>, size=1416, nrcpt=1 (queue active) Jul 5 21:47:00 mail6 postfix/smtp[28019]: 1A216210E8AE: to=<test@example.org>, relay=none, delay=37864, delays=37804/30/30/0, dsn=4.4.1, status=deferred (connect to example.org[192.0.43.10]: Connection timed out) Jul 5 23:09:20 mail6 postfix/qmgr[3022]: 1A216210E8AE: from=<direccion@cremaycosmeticanatural.es>, size=1416, nrcpt=1 (queue active) Jul 5 23:10:02 mail6 postfix/smtp[6562]: 1A216210E8AE: to=<test@example.org>, relay=none, delay=42846, delays=42805/32/9.3/0, dsn=4.4.1, status=deferred (connect to example.org[192.0.43.10]: Connection refused) Jul 6 00:32:40 mail6 postfix/qmgr[3022]: 1A216210E8AE: from=<direccion@cremaycosmeticanatural.es>, size=1416, nrcpt=1 (queue active) Jul 6 00:33:40 mail6 postfix/smtp[15683]: 1A216210E8AE: to=<test@example.org>, relay=none, delay=47865, delays=47805/30/30/0, dsn=4.4.1, status=deferred (connect to example.org[192.0.43.10]: Connection timed out) Jul 6 01:56:00 mail6 postfix/qmgr[3022]: 1A216210E8AE: from=<direccion@cremaycosmeticanatural.es>, size=1416, nrcpt=1 (queue active) Jul 6 01:57:00 mail6 postfix/smtp[24233]: 1A216210E8AE: to=<test@example.org>, relay=none, delay=52864, delays=52804/30/30/0, dsn=4.4.1, status=deferred (connect to example.org[192.0.43.10]: Connection timed out) Jul 6 03:19:20 mail6 postfix/qmgr[3022]: 1A216210E8AE: from=<direccion@cremaycosmeticanatural.es>, size=1416, nrcpt=1 (queue active) Jul 6 03:20:21 mail6 postfix/smtp[315]: 1A216210E8AE: to=<test@example.org>, relay=none, delay=57865, delays=57805/30/30/0, dsn=4.4.1, status=deferred (connect to example.org[192.0.43.10]: Connection timed out)
If there is any other log or information I can provide, please just tell me to, I'll be more than happy to track this thing down as I've been looking at it for two days now.
Change History (4)
comment:1 by , 12 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
comment:2 by , 12 years ago
Resolution: | invalid |
---|---|
Status: | closed → reopened |
Actually the real email addresses that should receive BCCs copies doesn't get the messages.
This happends on the production machine(webfaction) and even on the development machine, using the Console backend, only 1 message is shown instead of a message for every address on msg.receivers(). I've checked this last method and the result is as expected, the TO address and the BCC addresses.
The posted code is just a quick example to easy the reproduction of the problem and triage of the problem, as I thought the BCC field should appear somewhere on the headers at least on the Console backend. Sorry if that confused the ticket :-/
comment:3 by , 12 years ago
Resolution: | → invalid |
---|---|
Status: | reopened → closed |
Please do not reopen unless you can provide something new to the problem. The console backend won't show Bcc addresses, as it uses the message.as_string() method which doesn't contain the Bcc recipients.
There are other reasons that might prevent some receiver to receive a message. In this case, it is probably not Django's fault, unless you can prove us the contrary.
comment:4 by , 12 years ago
I happen to have a webfaction account, and BCC works fine for me. Also the number of messages printed on the console is correct - one for every message, not one for each address in msg.receivers() - see the console backend code.
BCC works fine for me, tested on Django 1.4 on a live server. We added BCC support in [5ff1d96a52] and fixed a bug in [319a31464d], so this has indeed been working for other people for a long time.
The output on the console is exactly what you would expect - the BCC addresses are not listed (that's what BCC means).
I've checked the SMTP code for sending, and it correctly sends the same email (without the BCC addresses) to all recipients (which includes all TO and BCC addresses). This is how SMTP works. Regarding your MTA logs, I don't know if it is evidence of a bug or not - it depends whether the 'to' listed is the 'to' address on the email or the contents of the 'RCPT TO' SMTP header.
(You mentioned the default 'IMAP' backend - I presume you meant SMTP).
Anyway, there is nothing reported that confirms that the emails are not in fact being sent. Have you actually tried for real and found that BCCs are not being sent? If so, are you sure that some other system is not swallowing them?
I'm going to close as INVALID for now, on the assumption that this is just based on a mistake about how SMTP works. Please re-open if the emails are not being sent, and there is a genuine bug in Django and you can provide information that will allow us to track it down.