Beispiel #1
0
 def email_invitation(self):
     text = get_template("class_management/email.html").render(
         Context({
             'URL': self.__get_invitation_registration_url(),
             'teacher_name': self.teacher.first_name,
         }))
     try:
         email = Email(to_address=self.email, message=text, subject="Invitation to Join Code-A-Ton")
         email.send()
         return True
     except Exception as e:
         LOGGER.error(e)
         return False
Beispiel #2
0
def contact_us_form(request):
    contact_us = ContactUsForm(request.POST)
    if contact_us.is_valid():
        name = contact_us.cleaned_data["name"]
        email = contact_us.cleaned_data["email"]
        phone = contact_us.cleaned_data["phone"]
        message = contact_us.cleaned_data["message"]
        context = RequestContext(request,
        {
            'name': name,
            'email': email,
            'phone': phone,
            'message': message
        })
        email_text = get_template("LandingPage/contact_us_email.html").render(context)
        email = Email(to_address=HELLO_EMAIL, message=email_text, subject="Contact Us Form")
        LOGGER.info("Sending Contact Us email submission success: " + str(email.send()))
    return HttpResponseRedirect("/")