Hi,
I am trying to send mail using sendmail. Getting the error 'unicode'
object has no attribute 'user'

My view function:

def send_mail(request):
    _user = request.user
    sender = _user.email
    mailing_list = []

    if request.method != 'POST':
        emailform = EmailForm()
        return render_to_response('email.html', locals())

    if request.method == 'POST':
        emailform = EmailForm(request.POST)
        if emailform.is_valid():
            to = emailform.clean_data['to']
            subject = emailform.clean_data['subject']
            message = emailform.clean_data['message']
            try:
                send_mail(subject, message, sender, to)
                request.user.message_set.create(message="Mail was send
successfully.")
                return HttpResponseRedirect('../')

            except Exception, e:
                raise ValueError,e
    return render_to_response( 'email.html', locals() )

Form:
class EmailForm(forms.Form):
    to = forms.EmailField()
    subject = forms.CharField(max_length=200)
    message = forms.CharField(widget=forms.Textarea({'class':'meeting-
detail-textarea'}))

Can someone help me out in this case.........

Thanks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to