summaryrefslogtreecommitdiff
path: root/pgweb/util
diff options
context:
space:
mode:
authorMagnus Hagander2020-04-20 08:47:56 +0000
committerMagnus Hagander2020-04-20 08:49:33 +0000
commita90cbd217e1e75c520c406e7f9fd9ab1e26cd201 (patch)
tree60ae187174fcfbcf45e7c7acfdf9d29f3238f256 /pgweb/util
parent9c69eed6e9440ab58c3d2799c1e37701e6bcd4d7 (diff)
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.
Diffstat (limited to 'pgweb/util')
-rw-r--r--pgweb/util/admin.py3
-rw-r--r--pgweb/util/misc.py16
2 files changed, 12 insertions, 7 deletions
diff --git a/pgweb/util/admin.py b/pgweb/util/admin.py
index f86a692d..9e02eddb 100644
--- a/pgweb/util/admin.py
+++ b/pgweb/util/admin.py
@@ -78,7 +78,8 @@ class PgwebAdmin(admin.ModelAdmin):
send_simple_mail(settings.NOTIFICATION_FROM,
obj.org.email,
"postgresql.org moderation notification",
- msgstr)
+ msgstr,
+ suppress_auto_replies=False)
# Also generate a mail to the moderators
send_simple_mail(
diff --git a/pgweb/util/misc.py b/pgweb/util/misc.py
index 5d45b7a0..2698031e 100644
--- a/pgweb/util/misc.py
+++ b/pgweb/util/misc.py
@@ -9,16 +9,20 @@ from pgweb.util.helpers import template_to_string
import re
-def send_template_mail(sender, receiver, subject, templatename, templateattr={}, usergenerated=False, cc=None, replyto=None, receivername=None, sendername=None, messageid=None):
+def send_template_mail(sender, receiver, subject, templatename, templateattr={}, usergenerated=False, cc=None, replyto=None, receivername=None, sendername=None, messageid=None, suppress_auto_replies=True, is_auto_reply=False):
d = {
'link_root': settings.SITE_ROOT,
}
d.update(templateattr)
- send_simple_mail(sender, receiver, subject,
- template_to_string(templatename, d),
- usergenerated=usergenerated, cc=cc, replyto=replyto,
- receivername=receivername, sendername=sendername,
- messageid=messageid)
+ send_simple_mail(
+ sender, receiver, subject,
+ template_to_string(templatename, d),
+ usergenerated=usergenerated, cc=cc, replyto=replyto,
+ receivername=receivername, sendername=sendername,
+ messageid=messageid,
+ suppress_auto_replies=suppress_auto_replies,
+ is_auto_reply=is_auto_reply,
+ )
def get_client_ip(request):