473,699 Members | 2,531 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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(rec ipients, "; ") + "\r\n" \
"From: " + "te*****@test.c om\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('s omething.someth ing.com')
result = server.sendmail ("te*****@test. com", recipients, text)
server.quit()
Any help is greatly appreciated.

Thanks
Jul 18 '05 #1
1 2108
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(rec ipients, "; ") + "\r\n" \
"From: " + "te*****@test.c om\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('s omething.someth ing.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
10955
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 working piece of code that emails jpg attachments but does not work with any other types of attachments. Could someone tell me how to modify this code to send other types of attachments like the one's stated above(especially PDF's)? Also how do I...
2
4856
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 the "To" recipients get the mail, thought the mail headers look right. but if i also add the "Cc" folks to the list of recipients in the call to smtplib.sendmail(), it arrives at their mailer with their address listed on both the "To" and "Cc"...
1
3397
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 is an important message." server = smtplib.SMTP('localhost') server.sendmail(frmadr, toadr, msg)
3
4672
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 previously functioning script suddenly failed last week. My ISP thinks it maybe something to do with upgrading CPanel on their server -- maybe a library was missed, but when I try and execute a script I get...
6
10016
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 an unexpected error. Here's my sample code: import smtplib
8
4850
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 = smtplib.SMTP('localhost') s.connect() s.sendmail(me, to, msg.as_string())
3
4393
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: >>> import smtplib >>> server = smtplib.SMTP('localhost') >>> server.sendmail('soothsayer@example.org', 'jcaesar@example.org', """To: jcaesar@example.org
2
6473
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: another@address.net From: my@address.net Subject: Shakespeare Quote
3
8212
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 spammer connects to us every few seconds, this quickly leads to a problem :-) I need to set a timelimit for the operation of smtplib.sendmail. It has to be thread based, because pymilter uses libmilter which is thread based. There are some...
8
5044
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 is body of the mail.'
0
8691
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8620
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9180
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9038
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7755
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4378
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4633
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3060
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2012
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.