Server.sendmail with no "to_addrs" parameter.

EdWhyatt ed.whyatt at gmail.com
Wed Mar 22 06:18:41 EST 2006


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 "none at mydomain.local" .

Any help would be greatly received.

Cheers
Ed




More information about the Python-list mailing list