Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6100365
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:22:40+00:00 2026-05-23T13:22:40+00:00

I am trying to let the manager of a site I’m developing send mail

  • 0

I am trying to let the manager of a site I’m developing send mail to the members and send get a confirmation page.

The send mail is working and sending the mail OK, but in the confirmation i want him to get the the list of people he sent the mail to.

So, i need to send the users_list from one function (view) to the other in the directs and read it in the other view sending it to render_to_response.

I’ve read a lot and tried reverse and many other things i read over the web but can’t seem to make it work…

The code:

def send_members_mail(request):
    #a list of all active users in the system to show for send mail
    users_list = User.objects.filter(is_active = True)
    if request.method == 'POST':
        form = UsersForm(request.POST)
        if form.is_valid():
            user_list = []
            cd = form.cleaned_data
            #getting a list of user s that where chosen for send mail, -1 for all users
            for user_id in request.POST.getlist('chk_users'):
                user_list.append(user_id)
            #sending the mail to all list
            if '-1' in user_list:
                 users_list = User.objects.filter(pk__in=users_list).values_list('email', flat=True)
            #sending mail to specific members
            else:
                 users_list = User.objects.filter(pk__in=user_list).values_list('email', flat=True)

            cd = form.cleaned_data

            try:
                send_mail(
                    cd['subject'],
                    cd['message'],
                    'support@test.com',
                    users_list,
                )
            except BadHeaderError:
                return HttpResponse('The Mail header was corrupted, It might be because a server error or might be that you have a virus on your computer!!! please try sending again')
            return redirect('/contacts/sent/', users_list=users_list)

    else:
        form = UsersForm()
    return render_to_response('contacts/send_members_mail.html', {'form':form, 'users_list':users_list}, context_instance=RequestContext(request))

def sent(request, users_list,  *args, **kwargs):
    assert False, users_list
    return render_to_response('contacts/sent.html', context_instance=RequestContext(request))

The first view is for getting the list of users, and sending it to the form, then getting the data from the form including the check boxes that where checked and then getting the users mail addresses for the users (users login by mail, so have to have a working mail) and then sending the mail to the users and redirecting to the send page (confirmation page) where the admin should get the list of users (THIS IS WHERE I AM GETTING STUCK, THIS AND THAT TO DO IN THE URLSCONF FILE)

thank you,

Erez

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T13:22:41+00:00Added an answer on May 23, 2026 at 1:22 pm

    Rather then trying to pass it in the reverse/redirect you could set users_list as a session variable. e.g.

    # before redirect
    request.session['users_list'] = users_list
    
    # in sent view
    users_list = request.session.get('users_list', None)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I don't know if I'm on the right track but I'm trying to let
trying to get my first android widget and let me tell you moving from
I'm trying to let users type in date and time values into an input
I am trying to let GoogleBot login to my website and bypass the authentication.
I'm trying to let a user "make his own service". most direct method I
Hi Guys i'm trying to let my Screen blink a morse code out using
I am using the jQuery Datepicker( http://keith-wood.name/datepick.html ). I am trying to let the
I've got this odd problem with jQuery. I'm trying to let the change of
What I'm trying to achieve is: Let inflector slug Ignore a special character in
Let me first explain what's I'm trying to do. So I have a entity

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.