Example #1
0
def send_message(receiver, subject, text):

    message = mail.EmailMessage()
    message.sender = users.get_current_user().email()
    message.subject = subject
    message.to = receiver
    message.body = text

    mail.check_email_valid(receiver, message.to)
    message.send()
Example #2
0
def validate_email(value):

    # check that we've actually been passed a value here
    if value is not None:
        # validate against the Django email_re above
        if not email_re.search(value):
            raise ValidationError('email invalid: %s' % value)
        # use appengine's own mail validation just to be sure (yes
        # it's almost useless but worth a check... just to be sure)
        mail.check_email_valid(value, 'email')
    else:
        raise ValidationError('email required')
Example #3
0
def log_error(subject, message, *args):
	if args:
		try:
			message = message % args
		except:
			pass

	logging.error(subject + ' : ' + message)

	subject = 'MyLife Error: ' + subject
	app_id = app_identity.get_application_id()
	sender = "MyLife Errors <errors@%s.appspotmail.com>" % app_id
	try:
		to = Settings.get().email_address
		mail.check_email_valid(to, 'To')
		mail.send_mail(sender, to, subject, message)
	except:
		mail.send_mail_to_admins(sender, subject, message)
Example #4
0
 def has_valid_email(self):
   try:
     check_email_valid(self.email, None)
     return True
   except InvalidEmailError, e:
     return False
Example #5
0
 def has_valid_email(self):
     try:
         check_email_valid(self.email, None)
         return True
     except InvalidEmailError, e:
         return False