def send(self, subject, body, subject_prefix='[Aste] '): subject = subject_prefix + subject sender = self.cfg.Mail.Sender recipients = self.cfg.Mail.Recipients message = mail.createMessage(sender, recipients, subject, body) mail.sendMail(sender, recipients, message, self.cfg.Mail.Host, self.cfg.Mail.Port, self.cfg.Mail.User, rot47(self.cfg.Mail.Password), self.cfg.Mail.TLS) self.note('Sent mail to %s with subject "%s"' % (recipients, subject))
action="store_true", default=False, help="Log to stdout only [default: %default]") options, args = parser.parse_args() if len(args) == 0: parser.print_help() exit(RC_WRONG_PARAMETER) if args[0].lower() == 'rot47': if len(args) != 2: parser.print_help() exit(RC_WRONG_PARAMETER) else: print rot47(args[1]) exit(RC_OK) if args[0].lower() != 'start': parser.print_help() exit(RC_WRONG_PARAMETER) # Setting up the environment # ========================== env = Environment(options) # Setting up the task # Errors thrown here are not logged and no status mail will be sent. try:
parser.add_option("--no-file-logging", dest="noFileLogging", action="store_true", default=False, help="Log to stdout only [default: %default]") options, args = parser.parse_args() if len(args) == 0: parser.print_help() exit(RC_WRONG_PARAMETER) if args[0].lower() == 'rot47': if len(args) != 2: parser.print_help() exit(RC_WRONG_PARAMETER) else: print rot47(args[1]) exit(RC_OK) if args[0].lower() != 'start': parser.print_help() exit(RC_WRONG_PARAMETER) # Setting up the environment # ========================== env = Environment(options) # Setting up the task # Errors thrown here are not logged and no status mail will be sent.