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

  • SEARCH
  • Home
  • 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 544771
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T10:41:26+00:00 2026-05-13T10:41:26+00:00

I have a very basic email app. The forms class is: class ContactForm(forms.Form): name

  • 0

I have a very basic email app. The forms class is:

class ContactForm(forms.Form):
    name = forms.CharField(max_length=100)
    subject = forms.CharField(max_length=100)
    sender = forms.EmailField()
    recipient_list = forms.EmailField()
    message = forms.CharField(widget=forms.Textarea)
    cc_myself = forms.BooleanField(initial=True)

The view function looks like this:

def contact_name(request, id):
    if request.method == 'POST': # If the form has been submitted...
        form = ContactForm(request.POST) # A form bound to the POST data
        if form.is_valid():
        name = form.cleaned_data['name']
        subject = form.cleaned_data['subject']
        message = form.cleaned_data['message']
        sender = form.cleaned_data['sender']
        cc_myself = form.cleaned_data['cc_myself']

        recipients = ['dennis@themenace.com']
        if cc_myself:
            recipients.append(sender)

        from django.core.mail import send_mail
        send_mail(subject, message, sender, recipients)
        return HttpResponseRedirect('/') # Redirect after POST
else:
    a=Entry.objects.get(pk=id)
    form = ContactForm(instance=a) # An unbound form
return render_to_response('email.html', {
    'form': form,
})

As long as I specify the recipient in the view, I have no problem. However, I want the message to be sent to the address(es) specified in the form field “recipient list”.
When I structure the view code like this:

recipients = form.cleaned_data['recipient_list']
            if cc_myself:
                recipients.append(sender)

            from django.core.mail import send_mail
            send_mail(subject, message, sender, recipients)
            return HttpResponseRedirect('/') # Redirect after POST

or:

recipients = request.POST.get('recipient_list', '')
                if cc_myself:
                    recipients.append(sender)

I get error “‘unicode’ object has no attribute ‘append'”. In short, it doesn’t work. What am I doing wrong?

  • 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-13T10:41:26+00:00Added an answer on May 13, 2026 at 10:41 am

    Since recipient_list is an EmailField it cleans to unicode. But you’re trying to treat the result as a list. So obviously, construct a list out of it and everything’s dandy:

    recipients = [form.cleaned_data['recipient_list']]
    if cc_myself:
        recipients.append(sender)
    

    … but really you should call the field recipient not recipient list as only 1 can be entered.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I recently upgraded VS 2005 to VS 2008. Unfortunately I have a very basic
I am implementing a very simple file database. I have 2 basic operations: void
We have very strange problem, one of our applications is continually querying server by
I have very little experience building software for Windows, and zero experience using the
i have very simple problem. I need to create model, that represent element of
I have very simple select like this: SELECT * FROM table WHERE column1 IN
I have a very strange problem. Under some elusive circumstances I fail to apply
I have a very simple problem which requires a very quick and simple solution
I have a very simple WPF application in which I am using data binding
I have a very large code base that contains extensive unit tests (using CppUnit).

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.