def execute(self, **kwargs): """ Send email message """ from . import actions with self.act_manager.app.app_context(): if self.act_manager.app.debug == True: msg = Message(sender='*****@*****.**') for func in [getattr(self, aa) for aa in dir(self) if aa.startswith('get_')]: result = func(**kwargs) if result: head, sep, tail = func.__name__.partition('_') if tail == 'attachments': for attachment in result: msg.add_attachment(attachment) else: setattr(msg, tail, result) mail = Mail(self.act_manager.app) mail.connect() mail.send(msg) if self.log_mail: """ Log email to a table with a timestamp. Note, for attachements, don't only log the file name and content_type, not the data. """ pass return