Ejemplo n.º 1
0
 def send_mail(self, request):
     data = self.cleaned_data
     try:
         mail = MailGun(subject="Website Inquiry",
                        message=data['message'],
                        fr=data['email'],
                        recipients=[settings.MAIL_CHURCH_DEFAULT_MAIL])
         mail.send()
         messages.info(request,
                       "You have successfuly sent a message, We will get back to you ASAP.")
     except Exception as e:
         messages.warning(request,
                        "We are not able to deliver you message at this time for the following reasons: %s <br /> Please try again later." % e)
         
Ejemplo n.º 2
0
    def send_activation_email(self, data=None, url=None, token=None):
        activeurl = "%s%s?token=%s" % (get_current_site(self.request), url, token)
        message = """Please visit the URL or copy and paste the url to your browser to activate your account.
                  <br />
                  Activation URL: <a href="%s" target="_blank">%s</a>
                  <br />
                  This activation token is only valid 24 hours after you register or request it.
                  """ % (activeurl,
                         activeurl)

        mail = MailGun(subject="Account Activation",
                       message=message,
                       fr=settings.MAIL_CHURCH_DEFAULT_MAIL,
                       recipients=[data['email']])
        mail.send()