I have a contact form on my site. The code which send the emails after successful validation is below:
def contact(request): if request.method == 'POST': form = ContactForm(request.POST) if form.is_valid(): if request.POST['send_me']: send_mail( request.POST['subject'], request.POST['message'], request.POST.get('email', 'nore...@example.com'), [request.POST.get('email', 'nore...@example.com')], ) mail_admins( request.POST['subject'], request.POST['message'], ) return HttpResponseRedirect(reverse('home')) else: form = ContactForm() return render_to_response('feedback.html', context_instance=RequestContext(request, {'form': form})) First I send the email to the user himself if he checked "Send me copy" on the form. Then I'm going to send his email to admins. The problem is I do not see his email address to allow admins to reply him. Is this a stupid behaviour of mail_admins? So I decided to use send_mail, but previously I need to convert settings.ADMINS tuples into email strings to specify in the function. I think to use something like recipients = [] for admin in settings.ADMINS: recipients += admin[1] But it seems to be unprofessional. How to extract email addresses from settings.ADMINS? I can't find mail_admins code to see how django developers did that. Please, if you can, post the code here. Good luck! -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.