Merge pull request #316 from pcoder/bug/3328/dcl_email_headers
Changed BaseEmail to accept from_address to modify the from header ac…
This commit is contained in:
commit
2f0b38302a
2 changed files with 14 additions and 4 deletions
|
@ -130,9 +130,11 @@ class OrderView(TemplateView):
|
||||||
}
|
}
|
||||||
email_data = {
|
email_data = {
|
||||||
'subject': "Data Center Light Order from %s" % context['email'],
|
'subject': "Data Center Light Order from %s" % context['email'],
|
||||||
'to': ['info@ungleich.ch'],
|
'from_address': '(datacenterlight) datacenterlight Support <support@datacenterlight.ch>',
|
||||||
'body': "\n".join(["%s=%s" % (k, v) for (k, v) in context.items()]),
|
'to': 'info@ungleich.ch',
|
||||||
'reply_to': [context['email']],
|
'context': context,
|
||||||
|
'template_name': 'new_order_notification',
|
||||||
|
'template_path': 'datacenterlight/emails/'
|
||||||
}
|
}
|
||||||
email = EmailMessage(**email_data)
|
email = EmailMessage(**email_data)
|
||||||
email.send()
|
email.send()
|
||||||
|
@ -153,6 +155,7 @@ class BetaAccessView(FormView):
|
||||||
|
|
||||||
email_data = {
|
email_data = {
|
||||||
'subject': 'DatacenterLight Beta Access Request',
|
'subject': 'DatacenterLight Beta Access Request',
|
||||||
|
'from_address': '(datacenterlight) datacenterlight Support <support@datacenterlight.ch>',
|
||||||
'to': form.cleaned_data.get('email'),
|
'to': form.cleaned_data.get('email'),
|
||||||
'context': context,
|
'context': context,
|
||||||
'template_name': 'request_access_confirmation',
|
'template_name': 'request_access_confirmation',
|
||||||
|
@ -167,6 +170,7 @@ class BetaAccessView(FormView):
|
||||||
|
|
||||||
email_data = {
|
email_data = {
|
||||||
'subject': 'DatacenterLight Beta Access Request',
|
'subject': 'DatacenterLight Beta Access Request',
|
||||||
|
'from_address': '(datacenterlight) datacenterlight Support <support@datacenterlight.ch>',
|
||||||
'to': 'info@ungleich.ch',
|
'to': 'info@ungleich.ch',
|
||||||
'context': context,
|
'context': context,
|
||||||
'template_name': 'request_access_notification',
|
'template_name': 'request_access_notification',
|
||||||
|
@ -217,6 +221,7 @@ class BetaProgramView(CreateView):
|
||||||
|
|
||||||
email_data = {
|
email_data = {
|
||||||
'subject': 'DatacenterLight Beta Access Request',
|
'subject': 'DatacenterLight Beta Access Request',
|
||||||
|
'from_address': '(datacenterlight) datacenterlight Support <support@datacenterlight.ch>',
|
||||||
'to': 'info@ungleich.ch',
|
'to': 'info@ungleich.ch',
|
||||||
'context': context,
|
'context': context,
|
||||||
'template_name': 'request_beta_access_notification',
|
'template_name': 'request_beta_access_notification',
|
||||||
|
@ -319,6 +324,7 @@ class IndexView(CreateView):
|
||||||
|
|
||||||
email_data = {
|
email_data = {
|
||||||
'subject': 'DatacenterLight Beta Access Request',
|
'subject': 'DatacenterLight Beta Access Request',
|
||||||
|
'from_address': '(datacenterlight) datacenterlight Support <support@datacenterlight.ch>',
|
||||||
'to': form.cleaned_data.get('email'),
|
'to': form.cleaned_data.get('email'),
|
||||||
'context': context,
|
'context': context,
|
||||||
'template_name': 'request_access_confirmation',
|
'template_name': 'request_access_confirmation',
|
||||||
|
@ -333,6 +339,7 @@ class IndexView(CreateView):
|
||||||
|
|
||||||
email_data = {
|
email_data = {
|
||||||
'subject': 'DatacenterLight Beta Access Request',
|
'subject': 'DatacenterLight Beta Access Request',
|
||||||
|
'from_address': '(datacenterlight) datacenterlight Support <support@datacenterlight.ch>',
|
||||||
'to': 'info@ungleich.ch',
|
'to': 'info@ungleich.ch',
|
||||||
'context': context,
|
'context': context,
|
||||||
'template_name': 'request_access_notification',
|
'template_name': 'request_access_notification',
|
||||||
|
|
|
@ -21,7 +21,10 @@ class BaseEmail(object):
|
||||||
|
|
||||||
self.email = EmailMultiAlternatives(self.subject, text_content)
|
self.email = EmailMultiAlternatives(self.subject, text_content)
|
||||||
self.email.attach_alternative(html_content, "text/html")
|
self.email.attach_alternative(html_content, "text/html")
|
||||||
self.email.from_email = '(ungleich) ungleich Support <info@ungleich.ch>'
|
if 'from_address' in kwargs:
|
||||||
|
self.email.from_email = kwargs.get('from_address')
|
||||||
|
else:
|
||||||
|
self.email.from_email = '(ungleich) ungleich Support <info@ungleich.ch>'
|
||||||
self.email.to = [kwargs.get('to', 'info@ungleich.com')]
|
self.email.to = [kwargs.get('to', 'info@ungleich.com')]
|
||||||
|
|
||||||
def send(self):
|
def send(self):
|
||||||
|
|
Loading…
Reference in a new issue