473,399 Members | 2,478 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,399 software developers and data experts.

sendMail problem

sangeeth
Expand|Select|Wrap|Line Numbers
  1. def sendMail(to, subject,text,files=[],server="127.0.0.1"):
  2.         assert type(to)==list
  3.         assert type(files)==list
  4.         fro = "xx@x.com"
  5.  
  6.         debug_print("CWD -> " + os.getcwd())
  7.         msg = MIMEMultipart()
  8.         msg['From'] = fro
  9.         msg['To'] = COMMASPACE.join(to)
  10.         msg['Date'] = formatdate(localtime=True)
  11.         msg['Subject'] = subject
  12.  
  13.         msg_body =  MIMEBase('text', "html")
  14.         msg_body.set_payload(text1)
  15.  
  16.  
  17.         msg.attach(msg_body)
  18.  
  19.         for file in files:
  20.                 part = MIMEBase('application', "octet-stream")
  21.                 part.set_payload( open(file,"rb").read() )
  22.                 Encoders.encode_base64(part)
  23.                 part.add_header('Content-Disposition', 'attachment; filename="%s"' % os.path.basename(file))
  24.                 msg.attach(part)
  25.  
  26.         smtp = smtplib.SMTP(server)
  27.         smtp.sendmail(fro, to, msg.as_string() )
  28.         smtp.close()
  29.  
Why is that for msg_body of bigger size I see some junk characters like "! and ;" appear.
Is there any limitation on the size of the mail sent.
help please
Apr 24 '07 #1
2 1683
Motoma
3,237 Expert 2GB
Where are these "junk characters" appearing? In the received email? In the message body? The subject line? The attachments?
Please elaborate.

Also, take a look at your data before you call the send function, does the information all look correct?
Apr 25 '07 #2
Where are these "junk characters" appearing? In the received email? In the message body? The subject line? The attachments?
Please elaborate.

Also, take a look at your data before you call the send function, does the information all look correct?
The junk character "!" is appearing in the message body
The junk character appears exactly after 2615 characters.
The text is fine before sending it through sendmail.
Apr 26 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Babaloo | last post by:
Hello, I am having a problem with PHP 4.2.2 and RH 8. PHP is working fine except email. I have a test script to send mail, I have sendmail_path = '/usr/lib/sendmail -t -i' set in php.ini,...
4
by: jim | last post by:
Hello, I am having a problem w/SendMail reporting: " No recipient addresses found in header". Funny thing is though, I properly recieve the email message. Thanks for your help. -jim
2
by: mike | last post by:
I've spent a couple of days on this and I'm to the "bang-my-head 'gainst the monitor and babble in tongues" mode. First - SuSE Pro 9.3, Linux 2.6.11.4-21.7, Apache 2.0.53, PHP 4.3.10 I have...
2
by: Anthony Boudouvas | last post by:
Hi to all, i am just try to send emails in a timer-loop fashion, using the code below and i get the following error message: Could not create 'CDONTS.NewMail' The problem is not happening...
7
by: Andrea Williams | last post by:
I have been using this code for a while now and I haven't changed this code for at least a couple weeks... I do not suspect the code. The error I'm getting is the following: Message: Could not...
3
by: swangdb | last post by:
I have a Sun Server running Solaris 10 and Sendmail 8.13.7. I have Majordomo and Listproc installed on this server and they work. I have several production majordomo and listproc mailing lists...
4
by: Nilesh | last post by:
I have a server in which sendmail gives problem. How do i change php.ini so that i can use exim for mail() System is FC-6.
4
by: Clodoaldo | last post by:
I need to know if an email was refused for whatever reason, it makes no difference. The email is sent to an email address that does not exist in a foreign domain. I can see in the postfix log...
4
by: Tinus | last post by:
Dear friends I am trying to sendd a mail from my php code: php gives a message that the mail was send successfully but nothing is actually sended.("i receive nothing") Thanks you for the help!...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
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
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
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.