Call self.ehlo() and/or self.helo() if needed. If there has been no previous EHLO or HELO command this session, this method tries ESMTP EHLO first. This method may raise the following exceptions: SMTPHeloError The server didn't reply properly to
(self)
| 604 | # some useful methods |
| 605 | |
| 606 | def ehlo_or_helo_if_needed(self): |
| 607 | """Call self.ehlo() and/or self.helo() if needed. |
| 608 | |
| 609 | If there has been no previous EHLO or HELO command this session, this |
| 610 | method tries ESMTP EHLO first. |
| 611 | |
| 612 | This method may raise the following exceptions: |
| 613 | |
| 614 | SMTPHeloError The server didn't reply properly to |
| 615 | the helo greeting. |
| 616 | """ |
| 617 | if self.helo_resp is None and self.ehlo_resp is None: |
| 618 | if not (200 <= self.ehlo()[0] <= 299): |
| 619 | (code, resp) = self.helo() |
| 620 | if not (200 <= code <= 299): |
| 621 | raise SMTPHeloError(code, resp) |
| 622 | |
| 623 | def auth(self, mechanism, authobject, *, initial_response_ok=True): |
| 624 | """Authentication command - requires response processing. |