diff options
| author | jhylton | 1998-08-13 19:57:46 +0000 |
|---|---|---|
| committer | jhylton | 1998-08-13 19:57:46 +0000 |
| commit | 7039b4cd7860fbd11873ff4d04b9c4a116ac78ca (patch) | |
| tree | 9a5f1d56f46d33a42b587d0685e70d9923f32c65 /Mailman/pythonlib | |
| parent | d0171b7513aedcf48f3a6366a14c2f12a9d61c1f (diff) | |
| download | mailman-7039b4cd7860fbd11873ff4d04b9c4a116ac78ca.tar.gz mailman-7039b4cd7860fbd11873ff4d04b9c4a116ac78ca.tar.zst mailman-7039b4cd7860fbd11873ff4d04b9c4a116ac78ca.zip | |
Change interface to sendmail: if the destination address is a string
instead of a list, turn it into a list containing that string. This
avoids an apparently common newbie mistake -- passing in a single
string for the destination and have it treated as a sequence of
characters.
Diffstat (limited to 'Mailman/pythonlib')
| -rwxr-xr-x | Mailman/pythonlib/smtplib.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Mailman/pythonlib/smtplib.py b/Mailman/pythonlib/smtplib.py index a812ef916..07f53fa19 100755 --- a/Mailman/pythonlib/smtplib.py +++ b/Mailman/pythonlib/smtplib.py @@ -42,6 +42,7 @@ End of HELP info import socket import string, re import rfc822 +import types SMTP_PORT = 25 CRLF="\r\n" @@ -317,11 +318,13 @@ class SMTP: #some useful methods - def sendmail(self,from_addr,to_addrs,msg,mail_options=[],rcpt_options=[]): + def sendmail(self, from_addr, to_addrs, msg, mail_options=[], + rcpt_options=[]): """ This command performs an entire mail transaction. The arguments are: - from_addr : The address sending this mail. - to_addrs : a list of addresses to send this mail to + (a string will be treated as a list with 1 address) - msg : the message to send. - mail_options : list of ESMTP options (such as 8bitmime) for the mail command @@ -376,6 +379,8 @@ class SMTP: self.rset() raise SMTPSenderRefused senderrs={} + if type(to_addrs) == types.StringType: + to_addrs = [to_addrs] for each in to_addrs: (code,resp)=self.rcpt(each, rcpt_options) if (code <> 250) and (code <> 251): |
