comparison src/plugins/plugin_misc_smtp.py @ 602:6fd1095b2b7b

core: sendMessage refactoring: - sendMessage now use JID instead of unicode, bridge method using unicode is now _sendMessage - added no_trigger argument, so it's now possible to forbid trigger execution (to avoid any plugin when we send a message)
author Goffi <goffi@goffi.org>
date Fri, 22 Feb 2013 00:15:50 +0100
parents e629371a28d3
children 84a6e83157c2
comparison
equal deleted inserted replaced
601:a4f6f78f0620 602:6fd1095b2b7b
88 88
89 def eomReceived(self): 89 def eomReceived(self):
90 """handle end of message""" 90 """handle end of message"""
91 mail = Parser().parsestr("\n".join(self.message)) 91 mail = Parser().parsestr("\n".join(self.message))
92 try: 92 try:
93 self.host.sendMessage(parseaddr(mail['to'].decode('utf-8', 'replace'))[1], mail.get_payload().decode('utf-8', 'replace'), # TODO: manage other charsets 93 self.host._sendMessage(parseaddr(mail['to'].decode('utf-8', 'replace'))[1], mail.get_payload().decode('utf-8', 'replace'), # TODO: manage other charsets
94 subject=mail['subject'].decode('utf-8', 'replace'), mess_type='normal', profile_key=self.profile) 94 subject=mail['subject'].decode('utf-8', 'replace'), mess_type='normal', profile_key=self.profile)
95 except: 95 except:
96 exc_type, exc_value, exc_traceback = sys.exc_info() 96 exc_type, exc_value, exc_traceback = sys.exc_info()
97 error(_("Can't send message: %s") % exc_value) # The email is invalid or incorreclty parsed 97 error(_("Can't send message: %s") % exc_value) # The email is invalid or incorreclty parsed
98 return defer.fail() 98 return defer.fail()