def post(self): user = yield get_user_settings(self.current_user.user_id, GLSettings.memory_copy.default_language) language = user['language'] yield get_notification(language) data = {} data['type'] = 'admin_test_static' data['node'] = yield admin_serialize_node(language) data['notification'] = yield get_notification(language) subject, body = Templating().get_mail_subject_and_body(data) send_to = user['mail_address'] log.debug("Attempting to send test email to: %s" % send_to) # If sending the email fails the exception mail address will be mailed. # If the failure is due to a bad SMTP config that will fail too, but it # doesn't hurt to try! try: yield sendmail(send_to, subject, body) except Exception as e: log.debug("Sending to admin failed. Trying an exception mail") raise e
def post(self): user = yield get_user_settings(self.current_user.user_id, State.tenant_cache[1].default_language) language = user['language'] data = { 'type': 'admin_test', 'node': (yield admin_serialize_node(language)), 'notification': (yield get_notification(language)), 'user': user, } subject, body = Templating().get_mail_subject_and_body(data) yield sendmail(user['mail_address'], subject, body)
def post(self): user = yield get_user_settings(self.current_user.user_id, GLSettings.memory_copy.default_language) language = user['language'] yield get_notification(language) data = {} data['type'] = 'admin_test_static' data['node'] = yield admin_serialize_node(language) data['notification'] = yield get_notification(language) subject, body = Templating().get_mail_subject_and_body(data) send_to = user['mail_address'] yield sendmail(send_to, subject, body)
def post(self): """ Parameters: None Response: None """ user = yield get_user_settings(self.current_user.user_id, GLSettings.memory_copy.default_language) notif = yield get_notification(user['language']) send_to = user['mail_address'] # Get the test emails subject line and body internationalized from notif subject = notif['admin_test_static_mail_title'] msg = notif['admin_test_static_mail_template'] log.debug("Attempting to send test email to: %s" % send_to) # If sending the email fails the exception mail address will be mailed. # If the failure is due to a bad SMTP config that will fail too, but it # doesn't hurt to try! try: yield sendmail(send_to, subject, msg) except Exception as e: log.debug("Sending to admin failed. Trying an exception mail") raise e