putting from email in reply-to: header [#29498563]
parent
cc097b0aa3
commit
d9a96c2ada
|
@ -51,14 +51,19 @@ def fac(n, sleep_interval=None):
|
|||
sleep(sleep_interval)
|
||||
return res
|
||||
|
||||
from django.core import mail
|
||||
from django.core.mail import get_connection
|
||||
from django.core.mail.message import EmailMessage
|
||||
|
||||
@task
|
||||
def send_mail_task(subject, message, from_email, recipient_list,
|
||||
fail_silently=False, auth_user=None, auth_password=None,
|
||||
connection=None):
|
||||
"""a task to drop django.core.mail.send_mail into """
|
||||
return mail.send_mail(subject, message, from_email, recipient_list, fail_silently, auth_user, auth_password, connection)
|
||||
connection = connection or get_connection(username=auth_user,
|
||||
password=auth_password,
|
||||
fail_silently=fail_silently)
|
||||
return EmailMessage(subject, message, from_email, recipient_list,
|
||||
connection=connection, headers = {'Reply-To': from_email }).send()
|
||||
|
||||
|
||||
from notification.engine import send_all
|
||||
|
|
|
@ -1765,7 +1765,7 @@ def emailshare(request):
|
|||
if form.is_valid():
|
||||
subject = form.cleaned_data['subject']
|
||||
message = form.cleaned_data['message']
|
||||
sender = sender = request.user.email
|
||||
sender = '%s via Unglue.it <%s>'%(request.user.username, request.user.email)
|
||||
recipient = form.cleaned_data['recipient']
|
||||
send_mail_task.delay(subject, message, sender, [recipient])
|
||||
try:
|
||||
|
|
Loading…
Reference in New Issue