I am having an issue with an authentication app I am writing. The app
saves the form appropriately but doesn't send the confirmation email.
I am using the same email_host settings as with other application that
send email messages but with no results. Here is the process.
First a form processes the information:
from django.contrib.auth.forms import UserCreationForm
from django import forms
from django.contrib.auth.models import User
from activate import send_activation
class RegisterForm(UserCreationForm):
email = forms.EmailField(label="E-Email")
class Meta:
model = User
fields = ("username", "email")
def clean_email(self):
email = self.cleaned_data["email"]
try:
User.objects.get(email=email)
except User.DoesNotExist:
return email
raise forms.ValidationError("A user with that email address
already exists.")
def save(self):
user = super(RegisterForm, self).save(commit=False)
send_activation(user)
user.is_active = False
user.save()
the activate.py file:
from django.core.mail import send_mail
from hashlib import md5
from django.template import loader, Context
from Obits.settings import BASE_URL as base_url
def send_activation(user):
code = md5(user.username).hexdigest()
url = "%sactivate/?user=%s&code=%s" % (base_url, user.username,
code)
template = loader.get_template('obits/eactivate.html')
context = ({
'username': user.username,
'url': url,
})
send_mail('Activate account at super site', 'this is a test',
'[email protected], [user.email], fail_silently=False)
The form saves to the DB, it hits all of the conditions but fails to
send an email. I can't get any error messages so I'm really at a loss.
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
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.