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 the serv
(self, sender, options=())
| 532 | return self.docmd("noop") |
| 533 | |
| 534 | def mail(self, sender, options=()): |
| 535 | """SMTP 'mail' command -- begins mail xfer session. |
| 536 | |
| 537 | This method may raise the following exceptions: |
| 538 | |
| 539 | SMTPNotSupportedError The options parameter includes 'SMTPUTF8' |
| 540 | but the SMTPUTF8 extension is not supported by |
| 541 | the server. |
| 542 | """ |
| 543 | optionlist = '' |
| 544 | if options and self.does_esmtp: |
| 545 | if any(x.lower()=='smtputf8' for x in options): |
| 546 | if self.has_extn('smtputf8'): |
| 547 | self.command_encoding = 'utf-8' |
| 548 | else: |
| 549 | raise SMTPNotSupportedError( |
| 550 | 'SMTPUTF8 not supported by server') |
| 551 | optionlist = ' ' + ' '.join(options) |
| 552 | self.putcmd("mail", "from:%s%s" % (quoteaddr(sender), optionlist)) |
| 553 | return self.getreply() |
| 554 | |
| 555 | def rcpt(self, recip, options=()): |
| 556 | """SMTP 'rcpt' command -- indicates 1 recipient for this mail.""" |