Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class PartsDS(EmailProcessor):
- desc_template = '[Parts Request]\n\nAuthor:{auth}\nSubject: {subj}' + \
- '\n\nDescription: {desc}'
- def __init__(self, config, crm_addr, running):
- super().__init__(config, crm_addr, running)
- self.imap_server = config['partsds']['imap_server']
- self.imap_user = config['partsds']['imap_user']
- self.imap_password = config['partsds']['imap_password']
- self.dest_acct = config['partsds']['destination_acct']
- self.mgr = config['partsds']['manager']
- self.allowed_domains = [domain.strip() \
- for domain in config['partsds']['allowed_domains'].split(',')]
- self._interval = int(config['partsds']['interval'])
- def _process_message(self, msg):
- ticket = entities.Ticket()
- desc = self.desc_template.format(auth = msg.get_from_addr(),
- subj = msg.subject,
- desc = msg.get_plaintext_body())
- ticket.set_field('AccountRecID', self.dest_acct)
- ticket.set_field('Description', desc)
- ticket.set_field('EmpRecID', self.mgr)
- logging.info('Created Parts ticket for UID %s', msg.uid)
- return ticket
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement