core, plugin imap, plugin smtp: fixed SMTP/IMAP integration. /!\ Profile need to be connected for IMAP server to work (will change in the future)
This commit is contained in:
parent
3e70ea196c
commit
2596ea291b
3 changed files with 8 additions and 6 deletions
|
|
@ -426,11 +426,10 @@ class SatProfileCredentialChecker:
|
|||
profiles = self.host.memory.getProfilesList()
|
||||
if not credentials.username in profiles:
|
||||
return defer.fail(cred_error.UnauthorizedLogin())
|
||||
password = self.host.memory.getParamA("Password", "Connection", profile_key=credentials.username)
|
||||
return defer.maybeDeferred(
|
||||
credentials.checkPassword,
|
||||
password).addCallback(
|
||||
self._cbPasswordMatch, credentials.username)
|
||||
d = self.host.memory.asyncGetParamA("Password", "Connection", profile_key=credentials.username)
|
||||
d.addCallback(lambda password: credentials.checkPassword(password))
|
||||
d.addCallback(self._cbPasswordMatch, credentials.username)
|
||||
return d
|
||||
|
||||
class ImapServerFactory(protocol.ServerFactory):
|
||||
protocol = imap4.IMAP4Server
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ class SatSmtpMessage:
|
|||
mail = Parser().parsestr("\n".join(self.message))
|
||||
try:
|
||||
self.host.sendMessage(parseaddr(mail['to'].decode('utf-8','replace'))[1], mail.get_payload().decode('utf-8','replace'), #TODO: manage other charsets
|
||||
subject=mail['subject'].decode('utf-8','replace'), type='normal', profile_key=self.profile)
|
||||
subject=mail['subject'].decode('utf-8','replace'), mess_type='normal', profile_key=self.profile)
|
||||
except:
|
||||
exc_type, exc_value, exc_traceback = sys.exc_info()
|
||||
error(_("Can't send message: %s") % exc_value) #The email is invalid or incorreclty parsed
|
||||
|
|
|
|||
Loading…
Reference in a new issue