AFAIK mail_admins is designed to send error messages to the site administrator, not for the purpose you are proposing, so you won't get the original email. Your proposal seems reasonable enough to me since you're not using mail_admins as designed.
Why take only the second admin email address? On an unrelated point you might to re-think your view. Once you've pass form.is_valid(), it is much better to read the data out of the form.cleaned_data dictionary than directly from the POST as Django takes care of type coercion, etc. Euan On Aug 5, 10:31 am, kostia <[email protected]> wrote: > 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', '[email protected]'), > > [request.POST.get('email', > '[email protected]')], > > ) > 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

