def member_email_contacts(request, username):
    user = User.objects.get(username=username)
    if user != request.user:
        return HttpResponseForbidden()

    contact_add_form = EmailContactForm(data=request.POST)
    if not contact_add_form.is_valid():
        return locals()
    
    new_contact = contact_add_form.save(user)
    registration_profile = contact_add_form.profile
    subject = "Please confirm your email address"
    body = registration_profile.render_to_string(
        "contact_manager/confirm_secondary_email_contact.txt")
    email = EmailMessageWithEnvelopeTo(subject, body, 
                                       settings.DEFAULT_FROM_EMAIL,
                                       [new_contact.email])
    email.send()

    messages.info(request, "Now check your email to confirm the contact.")
    return redirect("member_account", user.username)
 def clean_email(self):
     email_form = EmailContactForm(data={'email': self.cleaned_data['email']})
     if not email_form.is_valid():
         raise forms.ValidationError(email_form.errors['email'])
     self.email_form = email_form
     return self.cleaned_data['email']