26 Commits

Author SHA1 Message Date
adf5eb2a34 Add support for staggering outgoing emails
Sent email can be assigned a "stagger type", for which he system will
maintain a "last sent" information. When the email is sent, it will be
delayed to be at least "stagger" time after the last one sent of the
same type. If no email of this type has been sent before, the email is
of course sent immediately.
2020-10-29 15:27:56 +01:00
25180ee829 Remove unused function 2020-10-29 11:55:58 +01:00
7d1248bc23 Don't create duplicate headers in outgoing email
The python libraries will *append* a header if it's just added again,
which would cause the news to go out with two date headers. Oops. So
instead check if each header is present and in that case replace it
rather than appending.
2020-09-10 16:45:38 +02:00
f2fc72f93a Teach send_simple_mail about sending HTML email
If a HTML body is specified, the plaintext and html bodies will be sent
as a multipart/alternative MIME object.

Also teach it to add attachments with Content-ID and overriding the
Content-Disposition, to make it possible to reference images attached
using cid: type URLs.
2020-09-10 14:52:41 +02:00
f885aa205d Simplify admin preview of emails
Use the python3 function to get the plaintext body of the email, instead
of our own very limited one we had before.
2020-09-10 14:52:41 +02:00
59793b0ca7 Fix message preview in mailqueue model
UTF8 encoding issues since the python3 migration...
2020-07-03 18:05:47 +02:00
a90cbd217e Set headers for no auto response on most emails
Most of our auto-generated emails should not ask for auto replies (like
out of office messages or in particular, "held for moderation" notices
from our own list server), so set this header by default, and also the
header indicating if it's an auto submitted/auto replied message.

Specifically allow auto replies on moderation notices, since that's a
case where it might be really interesting for the moderator to see for
example an out of office message. At least for now that seems like a
good idea.
2020-04-20 10:49:33 +02:00
b91fbe66e7 Fix changed names of imports 2019-01-26 16:19:26 +01:00
a156829375 Generic unicode updates 2019-01-26 16:19:26 +01:00
7547b6f766 Update syntax for relative imports 2019-01-26 16:19:26 +01:00
142f0805c2 Update to new style exception catching 2019-01-26 16:19:26 +01:00
e3ec36b50c Remove multi-statement lines, per pep8 2019-01-17 20:52:17 +01:00
0883ac6423 Fix whitespace and indentation, per pep8 2019-01-17 20:47:43 +01:00
87237f6536 Tabs, meet your new overlords: spaces
In a quest to reach pep8, use spaces to indent rather than tabs.
2019-01-17 15:35:39 +01:00
a4efb719dc Generate bug-specific messsageids when generating bug reports
This makes the messageids shorter and easier to identify when linking to
them in the archives.
2018-09-24 22:50:45 +02:00
51dc1212a4 Fix incorrect exception name 2018-06-29 13:40:04 +02:00
7d9ed68b46 Add support for setting recipient name and sender name 2017-12-18 16:21:01 +01:00
dfd46afae4 Send -bugs and -docs emails from noreply address
Sending from the submitters address runs afoul to DMARC and other
restrictions. Instead, send the email from a defined noreply address.
Instead, add the original submitter to both the Cc and the Reply-To
header, to make sure they receive followups.

Patch by Stephen, minor changes by Magnus
2017-12-18 15:59:18 +01:00
097a732031 cc bugreports to the original submitter
This gives the submitter a chance to respond to their own message even
if it's not delivered through the list (for example, because they are
not subscribed, or because it's caught in moderation for other reasons).

Per discussion at the developer meeting.
2017-07-04 16:57:51 +01:00
af5e5d327b Decode emails in the queue
Imported from pgeu. Do simple decoding of emails in the queue instead of
just showing the b64-encoded version in the admin interface. Intended to
help with debugging only.
2016-12-17 14:00:22 +01:00
b9e2468c84 Add missing import 2016-05-15 20:56:45 +02:00
f3e1a189b4 Move django-inteacting tools to be management commands
Much easier to execute them in the correct environment now that we have
proper management commands in django.
2016-05-14 19:49:13 +02:00
a8500c3853 Add migrations for all existing models
When migrating on existing installations, run the

python manage.py migrate --fake-initial

command.
2016-05-14 19:49:12 +02:00
4c058a0013 Add Message-Id header to emails
The previous code, which was submitting locally, apparently didn't
need to provide a Message-Id header.  However, now that we're
directly submitting to a remote system, we need to make sure that
a Message-Id header exists or the emails will get bounced.

In addition, the Python docs for this module state that Message-Id
is really one of the required fields anyway.  It's unclear how many
real bugs we lost because of this, but I got involved when there
was complaining on IRC that a bug submitted didn't show up on the
-bugs list.

In case folks are wondering why I'm committing/pushing this (or how),
I've already fixed this on wrigleys (thanks to Andrew Gierth for
helping me debug and test the changes) and subsequently gave myself
access to this repo, to get this commit in, before anyone else
commits and overwrites my local hacks and breaks the bugs form again.
2014-01-12 22:49:41 -05:00
bfa9b2a105 Track which emails are "user generated" for different antispam treatment
Basically, user generated email (bug report form) will be sent to the mail
frontends for antispam. Any errors generated there will be ignored and
the mails "dropped on the floor". Other emails keep entering the system
through localhost and delivered there.
2014-01-11 20:46:48 +01:00
8f0b7e6b50 Switch email sending go through a queue table in the database
Import the code from the PostgreSQL Europe website to handle this, since it's
well proven by now.

Any points that send email now just write them to the database using the
functions in queuedmail.util. This means we can now submit notification
emails and such things within transactions and have them properly roll bcak
if something goes wrong (so no more incorrect notifications when there is
a database error).

These emails are picked up by a cronjob that runs frequently (typically
once per minute or once every 2 minutes) that submits them to the local
mailserver. By doing it out of line, this gives us a much better way of
dealing with cases where mail delivery is really slow.

The submission from the cronjob is now done with smtp to localhost instead
of opening a pipe to the sendmail command - though this should have no
major effects on anything.

This also removes the setting SUPPRESS_NOTIFICATIONS, as no notifications
are actually ever sent unless the cronjob is run. On development systems
they will just go into the queuedmail table, and can be deleted from there.
2014-01-11 12:33:06 +01:00