Server.sendmail with no to_addrs parameter.
Hi all, I have searched the group with no answer to this particular problem. In my sendmail program, I would like to have the ability to send a mail message with no-one email address in the To field. I do this by adding the mail to the CC field via a header. However, by the time I get to the point of sending the mail, my recipient list is now empty, so I get the SMTPRecipientsRefused error. Looking at smtplib.py, this error is raised by: if len(senderrs)==len(to_addrs): # the server refused all our recipients self.rset() raise SMTPRecipientsRefused(senderrs) So, being a fool I removed this check. I then got the next error, as self.data(msg) had unexpected data. Can anyone suggest how I can get round this? I have attempted numerous things, like making my recipient list = [''], but Exchange then tried to send the mail to [EMAIL PROTECTED] . Any help would be greatly received. Cheers Ed -- http://mail.python.org/mailman/listinfo/python-list
Re: Server.sendmail with no to_addrs parameter.
So it's a restriction of Python? What I am trying to simulate here is the sending of mail to addresses solely in the CC and/or BCC fields - both of which are possible through Outlook. -- http://mail.python.org/mailman/listinfo/python-list
Re: Server.sendmail with no to_addrs parameter.
Ok, totally unrelated, and on that subject, I will make sure I always have a recipient in the To: field. - hey it works if I do that anyway! But are you serious about that RFC Compliant thing? Can anyone shed anymore light on this? I cannot believe that (regardless of our opinions of them) Microsoft would allow this (un)knowingly! Thanks to all for their comments. Cheers Ed -- http://mail.python.org/mailman/listinfo/python-list
Adding Multiple Attachments to SMTP mail (msg.add_header)
Hi all, I hope there is someone out there who can help me out - it has to be something obvious. I am simulating mail traffic, and want to include multiple attachments to my mail. I have created a temporary array containing a number of files - for now just 2. Debugging my code, I can see that I am correctly storing the files in the array, and then 1 by 1 adding one file at a time to the message header. When the program is complete, the resultant mail has 2 attachments, as hoped. However, it is the second file attached twice, rather than the two unique files. I attach my code for passing the information to msg.add_header: (AttNum = 2) for doatt in range(AttNum): msg.add_header('Content-Disposition', 'attachment', filename=ATTselection[doatt]) doatt = doatt + 1 outer.attach(msg) .. body = MIMEText(Text) outer.attach(body) Like I said, it is correctly sending the 2 seperate files from my ATTselection array, but ultimately attaching the last file twice. If anyone can help/suggest something please please let me know! Thanks, Ed -- http://mail.python.org/mailman/listinfo/python-list