if __name__ == '__main__': log.debug('starting') log.debug('reading config') # read in our config config = ConfigSmasher(['configs']).smash() log.debug('config: %s' % config) log.debug('creating queue') # create our queue queue_config = config.get('queue') queue = KawaiiQueueClient(queue_config.get('name'), queue_config.get('host'), queue_config.get('port')) log.debug('creating mailer') # now create our mailer smtp_config = config.get('smtp') mailer = QueueMailer(queue, smtp_config.get('server'), smtp_config.get('port'), smtp_config.get('username'), smtp_config.get('password'), smtp_config.get('sender'))
# parse those cmd line options! log.debug('parsing args') args = parser.parse_args() log.debug('args: %s' % args) log.debug('reading config') # read in from the configs config = ConfigSmasher(['configs']).smash() log.debug('config: %s' % config) log.debug('creating queue') # create our queue queue_config = config.get('queue') queue = KawaiiQueueClient(queue_config.get('name'), queue_config.get('host'), queue_config.get('port')) log.debug('creating mailer') # create our mailer, attached to the new queue mailer = MailerClient(queue) log.debug('queueing mail') # have the mailer send the msg to the queue mailer.queue_mail(args.to, args.subject, args.body,
log.debug('sent!') if __name__ == '__main__': log.debug('starting') log.debug('reading config') # read in our config config = ConfigSmasher(['configs']).smash() log.debug('config: %s' % config) log.debug('creating queue') # create our queue queue_config = config.get('queue') queue = KawaiiQueueClient(queue_config.get('name'), queue_config.get('host'), queue_config.get('port')) log.debug('creating mailer') # now create our mailer smtp_config = config.get('smtp') mailer = QueueMailer(queue, smtp_config.get('server'), smtp_config.get('port'), smtp_config.get('username'), smtp_config.get('password'), smtp_config.get('sender')) log.debug('starting mailer') mailer.start()