I am sorry.I can not prepar well web design.

2011/6/17, Tiago Almeida <tiago.b.alme...@gmail.com>:
> Try opening a django shell and calling send_mail by hand to see what
> exception you get (if any).
> Best Regards,
>
> On 17 Jun, 07:27, raj <nano.ri...@gmail.com> wrote:
>> Hey guys,
>>
>> I have a webfaction account, and I was trying to get a contact form
>> working for my website. The problem is that I can't seem to get it to
>> work. Can someone walk me through this? I couldn't figure it out from
>> the djangobook tutorial. I think something is wrong with my settings
>> and stuff. Here are my files:
>>
>> forms.py:
>>
>> from django import forms
>>
>> class ContactForm(forms.Form):
>>     email = forms.EmailField()
>>     name = forms.CharField()
>>     subject = forms.CharField()
>>     message = forms.CharField(widget=forms.widgets.Textarea())
>>
>> views.py:
>>
>> def contact(request):
>>     if request.method == 'POST':
>>         form = ContactForm(request.POST)
>>         if form.is_valid():
>>             cd = form.cleaned_data
>>             send_mail(
>>                 cd['subject'] + " - " + cd['name'],
>>                 cd['message'],
>>                 cd.get('email', 'nore...@oneadmissions.com'),
>>                 ['i...@oneadmissions.com'],
>>             )
>>             return HttpResponseRedirect('/contact/thanks/')
>>     else:
>>         form = ContactForm()
>>     return render_to_response('/home/oneadmin/webapps/oneadmin/
>> oneadmin/templates/oneadmissions/contact.html', {'form': form},
>> context_instance=RequestContext(request))
>>
>> def thanks(request):
>>     return render_to_response('/home/oneadmin/webapps/oneadmin/
>> oneadmin/templates/oneadmissions/random.html', {'phrase': "Thank you!
>> We will get back to you shortly"},
>> context_instance=RequestContext(request))
>>
>> settings.py:
>>
>> EMAIL_HOST = 'smtp.webfaction.com'
>> EMAIL_HOST_USER = 'i...@oneadmissions.com' #the email account that
>> receives the email
>> EMAIL_HOST_PASSWORD = 'PASSWORD'
>> EMAIL_USE_TLS = True
>>
>> *****I've tried adding an EMAIL_PORT, DEFAULT_FROM_EMAIL, and
>> SERVER_EMAIL variables, didn't do anything.
>>
>> urls.py:
>> urlpatterns = patterns('',
>>                         (r'^contact/$', views.contact),
>>                         (r'^contact/thanks/$', views.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
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to