Hello all

I've got an issue with django.core.mail that's driving me crazy... I'm
using a custom manipulator to handle the data submitted through a web
contact form... everything works great except that when I import and
try to use send_mail() from django.core.mail I get strange results

send_mail() works great as long as the email address in question is
under 21 characters... doesn't matter what 21 characters they are, but
if it goes over that limit the page throws a mod_python "list index
out of range" error...

Anybody have any insight into this?

The strange thing is another app in the same project uses the exact
same code and works perfectly, no matter what the address length is...
I've been pulling my hair out over this for two hours now and I can't
figure it out, any help is appreciated.

here's my manipulator if that helps:

class ContactManipulator(forms.Manipulator):
        def __init__(self):
                self.fields = (
                        forms.EmailField(field_name="email", is_required=True),
                        forms.TextField(field_name="name", length=30, 
maxlength=200,
is_required=True),
                        forms.TextField(field_name="subject", length=30, 
maxlength=200,
is_required=True),
                        forms.LargeTextField(field_name="comments", 
is_required=True),
                )

def contact_form(request):
        manipulator = ContactManipulator()
        if not request.POST:
                errors = new_data = {}
                form = forms.FormWrapper(manipulator, new_data, errors)
                return render_to_response('contact_form.html', {'form': form})
        else:
                new_data = request.POST.copy()
                errors = manipulator.get_validation_errors(new_data)
                if not errors:
                        manipulator.do_html2python(new_data)
                        mail_subject = '[Sweetleaf]  %s ' % 
(new_data['subject'])
                        mail_body = 'Hello Admin, \n my name is %s \n I 
wrote:\n\n %s \n\n
you write me back at %s ' % (new_data['name'], new_data['comments'],
new_data['email'])
                        send_mail(mail_subject, mail_body, '[EMAIL PROTECTED]',
['[EMAIL PROTECTED]'], fail_silently=False)
                        return HttpResponseRedirect("/contact/thankyou/")
                else:
                        form = forms.FormWrapper(manipulator, new_data, errors)
        return render_to_response('contact_form.html', {'form': form})



I have a feeling I'm gonna feel pretty silly for this when I sort it
out, but in the mean time it's the only thing holding up the launch of
this site.

Also as a footnote, I have this manipulator in my view.py... is that
the recommended place for it or should I move that somewhere else?

cheers
sng
<http://luxagraf.net>

--~--~---------~--~----~------------~-------~--~----~
 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