def send_notification(email, context): from smtplib import SMTPException if not email: return False try: send_email( email, 'send_money/email/debit-card-confirmation.txt', gettext('Send money to a prisoner: your payment was successful'), context=context, html_template='send_money/email/debit-card-confirmation.html' ) return True except SMTPException: logger.exception('Could not send successful payment notification')
def send_task_failure_notification(email, context): if not email: return False activate(settings.LANGUAGE_CODE) context["feedback_url"] = urljoin(settings.SITE_URL, reverse("submit_ticket")) try: send_email( email, "prisoner_location_admin/email/failure-notification.txt", gettext("Send money to a prisoner: prisoner location update failed"), context=context, html_template="prisoner_location_admin/email/failure-notification.html", ) return True except SMTPException: logger.exception("Could not send location upload failure notification")