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)
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
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)
def _ehlo(self): with Timeout(self.command_timeout): ehlo = self.client.ehlo(self.ehlo_as) if ehlo.is_error(): raise SmtpRelayError.factory(ehlo)
def _banner(self): with Timeout(self.command_timeout): banner = self.client.get_banner() if banner.is_error(): raise SmtpRelayError.factory(banner)
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
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