def send(self, view: View, mail: Mail): name = self.request.param('name') mail_class = get_mail_class(name) if not issubclass(mail_class, Mailable): self.request.back() if self.request.all(): variables = self.request.all() else: variables = mail_class.placeholder_variables mail.mailable(mail_class('*****@*****.**', variables)).send() return 'ok'
def detail(self, view: View, mail: Mail): name = self.request.param('name') mail_class = get_mail_class(name) if not issubclass(mail_class, Mailable): self.request.back() # TODO: load default parameters if no query parameters, update Mailable to store variables example if self.request.all_query(): variables = self.request.all_query() else: variables = mail_class.placeholder_variables email = mail.mailable(mail_class('*****@*****.**', variables)) return { 'text': email.text_content, 'html': email.html_content, 'default_params': mail_class.placeholder_variables }