def send_warning_emails(): """ :return: """ emailer = Emailer(host=SMTP_HOST, login_username=SMTP_USERNAME, login_password=SMTP_PASSWORD, tls_port=SMTP_TLS_PORT) warnings = MemberWarning.objects.filter(notified=False, acknowledged=False) for warning in warnings: recipients_string = warning.get_recipients_string() if recipients_string is None: continue subject, body = warning.get_subject_and_body() if subject is None or body is None: continue emailer.send_message(recipients_string, NOTIFICATION_EMAIL_ADDRESS, NOTIFICATION_EMAIL_SUBJECT_LEAD + " %s" % (subject,), body) warning.notified = True warning.save()
def send_warning_emails(): """ :return: """ emailer = Emailer(host=SMTP_HOST, login_username=SMTP_USERNAME, login_password=SMTP_PASSWORD, tls_port=SMTP_TLS_PORT) warnings = MemberWarning.objects.filter(notified=False, acknowledged=False) for warning in warnings: recipients_string = warning.get_recipients_string() if recipients_string is None: continue subject, body = warning.get_subject_and_body() if subject is None or body is None: continue emailer.send_message( recipients_string, NOTIFICATION_EMAIL_ADDRESS, NOTIFICATION_EMAIL_SUBJECT_LEAD + " %s" % (subject, ), body) warning.notified = True warning.save()
def send_exception_email(exception_message): """ :param exception_message: :return: """ emailer = Emailer(host=SMTP_HOST, login_username=SMTP_USERNAME, login_password=SMTP_PASSWORD, tls_port=SMTP_TLS_PORT) emailer.send_message(User.objects.get(username__iexact="admin").email, NOTIFICATION_EMAIL_ADDRESS, NOTIFICATION_EMAIL_SUBJECT_LEAD + " exception", exception_message)
def send_exception_email(exception_message): """ :param exception_message: :return: """ emailer = Emailer(host=SMTP_HOST, login_username=SMTP_USERNAME, login_password=SMTP_PASSWORD, tls_port=SMTP_TLS_PORT) emailer.send_message( User.objects.get(username__iexact="admin").email, NOTIFICATION_EMAIL_ADDRESS, NOTIFICATION_EMAIL_SUBJECT_LEAD + " exception", exception_message)