473,407 Members | 2,598 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

smtplib sendmail problems

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
1 2093
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Bill | last post by:
I am trying to have the capability to email attachments. Specifically I want to be able to email a specific attachment that I name that may be a PDF document, text doc, etc. I already have a...
2
by: Garry Hodgson | last post by:
how do i use smtplib to send mail to someone with "cc" to someone else? if i just include the "to" addressees in the call to smtplib.sendmail(), and put the others in the "Cc" header fields, only...
1
by: Jeff Sandys | last post by:
Can you include a subject with sendmail using smtplib? When I do this (names changed to protect the innocent): import smtplib toadr = "me@myisp.com" frmadr = "myhost@myhost.com" msg = "this...
3
by: yazzoo | last post by:
Does anyone know what causes an SMTPLIB DataError? The only thing I can find in the manual is exception SMTPDataError The SMTP server refused to accept the message data. My problem is a...
6
by: Matthias Kluwe | last post by:
Hi! After getting a @gmail.com address, I recognized I had to use TLS in my python scripts using smtplib in order to get mail to the smtp.gmail.com server. Things work well so far, apart from...
8
by: Jon Hewer | last post by:
hi having a few problems sending an email with smtplib. i do have an smtp server running on port 25 of my local machine here's the relevant code (taken from python docs): s =...
3
by: Van_Gogh | last post by:
Hi, I am learning how to use the smtplib module, but am having some very early problems, maybe because I don't understand it. So, am I correct that by following the example in the Python: >>>...
2
by: carl.reimann | last post by:
In using a simple smtp routine: # begin example >>> import smtplib >>> server = smtplib.SMTP('outgoing.verizon.net') >>> server.sendmail('my@address.net', 'another@address.net', """To:...
3
by: Stuart D. Gathman | last post by:
I am doing SMTP callbacks in a Python milter (http://pymilter.sourceforge.net) using the smtplib module. For some spammer MXes, it takes days (!) before smtplib.sendmail will return. Since the...
8
by: NicolasG | last post by:
I'm using the following code to send e-mail through python: import smtplib fromaddr = 'myMail@gmail.com' toaddrs = 'myOtherMail@gmail.com' subject = 'someting for subject !' msg = 'This...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.