Ejemplo n.º 1
0
 def _check_replies(self, mailfrom, rcpttos, data):
     if mailfrom.is_error():
         raise SmtpRelayError.factory(mailfrom)
     for rcptto in rcpttos:
         if not rcptto.is_error():
             break
     else:
         raise SmtpRelayError.factory(rcpttos[0])
     if data.is_error():
         raise SmtpRelayError.factory(data)
Ejemplo n.º 2
0
 def _send_message_data(self, envelope):
     header_data, message_data = envelope.flatten()
     with Timeout(self.data_timeout):
         send_data = self.client.send_data(header_data, message_data)
     self.client._flush_pipeline()
     if send_data.is_error():
         raise SmtpRelayError.factory(send_data)
     return send_data
Ejemplo n.º 3
0
 def _starttls(self):
     with Timeout(self.command_timeout):
         starttls = self.client.starttls(self.tls)
     if starttls.is_error() and self.tls_required:
         raise SmtpRelayError.factory(starttls)
Ejemplo n.º 4
0
 def _ehlo(self):
     with Timeout(self.command_timeout):
         ehlo = self.client.ehlo(self.ehlo_as)
     if ehlo.is_error():
         raise SmtpRelayError.factory(ehlo)
Ejemplo n.º 5
0
 def _banner(self):
     with Timeout(self.command_timeout):
         banner = self.client.get_banner()
     if banner.is_error():
         raise SmtpRelayError.factory(banner)
Ejemplo n.º 6
0
 def _rcptto(self, rcpt):
     with Timeout(self.command_timeout):
         rcptto = self.client.rcptto(rcpt)
     if rcptto and rcptto.is_error():
         raise SmtpRelayError.factory(rcptto)
     return rcptto
Ejemplo n.º 7
0
 def _mailfrom(self, sender):
     with Timeout(self.command_timeout):
         mailfrom = self.client.mailfrom(sender)
     if mailfrom and mailfrom.is_error():
         raise SmtpRelayError.factory(mailfrom)
     return mailfrom