问题
I'm developing an app on Django 1.6
In this app, there is a section, where a User which publishes a project can receive a message from a freelancer interested into this project.
So far this is the code I have:
# Send email
if user_profile.contracting:
subject = _('Your question on project {} has been answered')
body = _('You can read your answer here {}')
email = question.user.email
else:
subject = _('Your have a new question on project {}')
body = _('You can read your question here: {}')
email = project.user.email
send_mail(subject.format(project.name),
body.format(
os.environ.get('CURRENT_URL') + '/' +
reverse('projects_id', args=(project.id,))[1:]),
'no_responder@contratalos.com', [email, 'info@contratalos.com'])
return HttpResponseRedirect(reverse('projects_id',
args=(project.id,)))
else:
d = {'form': ProjectMessagesForm(request.POST)}
return render_to_response('projects/questions.html', d,
context_instance=RequestContext(request))
If you look at this line:
no_responder@contratalos.com', [email, 'info@contratalos.com'])
I'm adding the previous 'email' declaration and another recipient info@contratalos.com
, this second recipient fails, I don't receive any error message, but the message is not sent.
I don't know what the cause could be... Since I don't have any traceback to it...
Any ideas?
EDIT
This line works:
no_responder@contratalos.com', [email, 'info@contratalos.com'])
But I just need to make info@contratalos.com
to be like a bcc address, I mean invisible to the email
user.
回答1:
You should consider send_mass_email
subject = ...
message = ...
send_mass_mail((
subject,
message,
'no_responder@contratalos.com',
[email, 'kristian.koci@gmail.com']
), fail_silently=False)
回答2:
Nevermind, the message had a delay, now I received it, lol, Thanks!
来源:https://stackoverflow.com/questions/31797134/send-email-to-multiple-recipients-with-bcc-hidden-address-django-1-6