def process_message(self, peer, mailfrom, rcpttos, data): parser = email.parser.FeedParser() parser.feed(data) msg = parser.close() toAddress = msg['To'] fromAddress = msg['From'] subject = msg['Subject'] body = self._bmformat(msg) #Make sure we don't send an actually blank subject or body--this can cause problems. if not subject: subject = ' ' if not body: body = ' ' if bminterface.send(toAddress, fromAddress, subject, body): print "Message queued for sending..." else: print "There was an error trying to send the message..." return 0
def process_message(self, peer, mailfrom, rcpttos, data): parser = email.parser.FeedParser() parser.feed(data) msg = parser.close() toAddress = msg['To'] fromAddress = msg['From'] subject = u' '.join(unicode(t[0], t[1] or 'UTF-8') for t in email.header.decode_header(msg['Subject'])).encode('UTF-8') body = self._bmformat(msg) #Make sure we don't send an actually blank subject or body--this can cause problems. if not subject: subject = ' ' if not body: body = ' ' if bminterface.send(toAddress, fromAddress, subject, body): logging.info("Message queued for sending...") else: logging.info("There was an error trying to send the message...") return 0
def process_message(self, peer, mailfrom, rcpttos, data): parser = email.parser.FeedParser() parser.feed(data) msg = parser.close() toAddress = msg['To'] fromAddress = msg['From'] subject = u' '.join( unicode(t[0], t[1] or 'UTF-8') for t in email.header.decode_header( msg['Subject'])).encode('UTF-8') body = self._bmformat(msg) #Make sure we don't send an actually blank subject or body--this can cause problems. if not subject: subject = ' ' if not body: body = ' ' if bminterface.send(toAddress, fromAddress, subject, body): print "Message queued for sending..." else: print "There was an error trying to send the message..." return 0