with Reply-To set to the originator. (bug 704992)
This commit is contained in:
Allen Short 2011-11-29 15:17:14 -08:00
Родитель 12ea0b8574
Коммит 58b343baa6
4 изменённых файлов: 16 добавлений и 12 удалений

Просмотреть файл

@ -20,7 +20,7 @@ from django.core import paginator
from django.core.cache import cache
from django.core.serializers import json
from django.core.validators import ValidationError, validate_slug
from django.core.mail import send_mail as django_send_mail
from django.core.mail import EmailMessage
from django.forms.fields import Field
from django.template import Context, loader
from django.utils.translation import trans_real
@ -127,9 +127,9 @@ def paginate(request, queryset, per_page=20, count=None):
def send_mail(subject, message, from_email=None, recipient_list=None,
fail_silently=False, use_blacklist=True, perm_setting=None,
connection=None):
headers=None, connection=None):
"""
A wrapper around django.core.mail.send_mail.
A wrapper around django.core.mail.EmailMessage.
Adds blacklist checking and error logging.
"""
@ -184,14 +184,17 @@ def send_mail(subject, message, from_email=None, recipient_list=None,
send_message = template.render(Context(context,
autoescape=False))
result = django_send_mail(subject, send_message,
from_email, [recipient],
fail_silently=False,
connection=connection)
result = EmailMessage(subject, send_message,
from_email, [recipient],
connection=connection,
headers=headers or {},
).send(fail_silently=False)
else:
result = django_send_mail(subject, message, from_email,
white_list, fail_silently=False,
connection=connection)
result = EmailMessage(subject, message, from_email,
white_list,
connection=connection,
headers=headers or {},
).send(fail_silently=False)
else:
result = True
except Exception as e:

Просмотреть файл

@ -1409,7 +1409,7 @@ class TestPurchases(amo.tests.TestCase):
eq_(len(mail.outbox), 1)
email = mail.outbox[0]
eq_(email.to, ['a@a.com'])
eq_(email.from_email, 'regular@mozilla.com')
eq_(email.from_email, 'nobody@mozilla.org')
assert '$1.00' in email.body
@patch('stats.models.Contribution.is_instant_refund')

Просмотреть файл

@ -833,7 +833,7 @@ def refund_reason(request, contribution, wizard):
(request.amo_user.pk, addon.pk))
# L10n: %s is the addon name.
send_mail(_(u'New Refund Request for %s' % addon.name),
template, request.amo_user.email,
template, settings.NOBODY_EMAIL,
[smart_str(addon.support_email)])
return redirect(reverse('users.support',
args=[contribution.pk, 'refund-sent']))

Просмотреть файл

@ -51,6 +51,7 @@ FLIGTAR = 'amo-admins@mozilla.org'
EDITORS_EMAIL = 'amo-editors@mozilla.org'
SENIOR_EDITORS_EMAIL = 'amo-admin-reviews@mozilla.org'
MARKETPLACE_EMAIL = 'amo-marketplace@mozilla.org'
NOBODY_EMAIL = 'nobody@mozilla.org'
DATABASES = {
'default': {