SMTP 'mail' command -- begins mail xfer session. This method may raise the following exceptions: SMTPNotSupportedError The options parameter includes 'SMTPUTF8' but the SMTPUTF8 extension is not supported by th
(self, sender, options=())
| 525 | return self.docmd("noop") |
| 526 | |
| 527 | def mail(self, sender, options=()): |
| 528 | """SMTP 'mail' command -- begins mail xfer session. |
| 529 | |
| 530 | This method may raise the following exceptions: |
| 531 | |
| 532 | SMTPNotSupportedError The options parameter includes 'SMTPUTF8' |
| 533 | but the SMTPUTF8 extension is not supported by |
| 534 | the server. |
| 535 | """ |
| 536 | optionlist = '' |
| 537 | if options and self.does_esmtp: |
| 538 | if any(x.lower()=='smtputf8' for x in options): |
| 539 | if self.has_extn('smtputf8'): |
| 540 | self.command_encoding = 'utf-8' |
| 541 | else: |
| 542 | raise SMTPNotSupportedError( |
| 543 | 'SMTPUTF8 not supported by server') |
| 544 | optionlist = ' ' + ' '.join(options) |
| 545 | self.putcmd("mail", "FROM:%s%s" % (quoteaddr(sender), optionlist)) |
| 546 | return self.getreply() |
| 547 | |
| 548 | def rcpt(self, recip, options=()): |
| 549 | """SMTP 'rcpt' command -- indicates 1 recipient for this mail.""" |