By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,100 Members | 2,846 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,100 IT Pros & Developers. It's quick & easy.

smtplib sendmail problems

P: n/a
Hi,

I have a function that sends mail but I'm finding the number of
characters in the To: field is limited to ~255 characters. This means
that email is sent to only part of the email list.
#recipients is a list of email addresses, greater than 255 characters
in total

header = "To: " + string.join(recipients, "; ") + "\r\n" \
"From: " + "te*****@test.com\r\n" \
"Date: " + time.strftime("%A, %B %d, %Y %I:%M %p",
sendTime)+ "\r\n"
"X-Mailer: Automated Test \r\n" \
"Subject: " + subject + "\r\n\r\n"
text = header + mailText
server = smtplib.SMTP('something.something.com')
result = server.sendmail("te*****@test.com", recipients, text)
server.quit()
Any help is greatly appreciated.

Thanks
Jul 18 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Hank wrote:

I have a function that sends mail but I'm finding the number of
characters in the To: field is limited to ~255 characters. This means
that email is sent to only part of the email list.

#recipients is a list of email addresses, greater than 255 characters
in total

header = "To: " + string.join(recipients, "; ") + "\r\n" \
"From: " + "te*****@test.com\r\n" \
"Date: " + time.strftime("%A, %B %d, %Y %I:%M %p",
sendTime)+ "\r\n"
"X-Mailer: Automated Test \r\n" \
"Subject: " + subject + "\r\n\r\n"
text = header + mailText
server = smtplib.SMTP('something.something.com')
result = server.sendmail("te*****@test.com", recipients, text)
server.quit()


What does "recipients" contain? That's the relevant thing here,
not the To: header.

SMTP does not use the To: header for any purpose. In fact, it can
be absent. If only some people are receiving your message, it is
something to do with the recipients list (note: it must be a list)
and not the header. Or there's a problem with an intermediate
mail relay. Or something else. Always lots of ways for this stuff
to fail except, generally, the To: header.

-Peter
Jul 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.