Verified Commit 41201913 authored by Giancarlo Razzolini's avatar Giancarlo Razzolini
Browse files

news: Change the news app to use the EmailMessage class to be able to include the mailman password

Due to spamming to arch-announce mail list, we now use a poster password to make sure only authorized
emails are allowed through to the list.
parent c292bdd0
from django import forms
from django.core.mail import send_mail
from django.conf import settings
from django.core.mail import EmailMessage
from django.http import HttpResponse
from django.shortcuts import get_object_or_404, redirect
from django.template import loader
......@@ -39,16 +40,19 @@ def form_valid(self, form): = self.request.user
newsitem.slug = find_unique_slug(News, newsitem.title)
if newsitem.send_announce:
if newsitem.send_announce and settings.MAILMAN_PASSWORD:
ctx = {
'news': newsitem,
headers = {
'Approved': settings.MAILMAN_PASSWORD,
template = loader.get_template('news/news_email_notification.txt')
send_mail('[arch-announce] %s' % newsitem.title,
'"Arch Linux: Recent news updates: %s" <>' %,
EmailMessage(subject='[arch-announce] %s' % newsitem.title,
from_email='"Arch Linux: Recent news updates: %s" <>' %,
return super(NewsCreateView, self).form_valid(form)
......@@ -178,6 +178,9 @@
# Make this unique, and don't share it with anybody.
SECRET_KEY = '00000000000000000000000000000000000000000000000'
# Mailman poster password for announcements
'default': {
'ENGINE': 'django.db.backends.sqlite3',
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment