473,394 Members | 1,811 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,394 software developers and data experts.

Mime

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
0 700

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

Similar topics

1
by: Xaver Biton | last post by:
Hi, my internet provvider doesn' have support for pear and I tried the manual Installation as in the installation manual but when I call the script <?php ini_set("include_path",...
0
by: clevariant | last post by:
Hello, I'm tasked with creating a WSDL file that is compatible with .NET's code gen' tool, wsdl.exe. I'm getting an error in the code output saying "Missing soap:body input binding", which...
1
by: Michael Loughry | last post by:
I'm writing a web application that fetches documents from the server and sends them to the client. I do this using the Response.BinaryWrite method. However, is there any way to detect the MIME...
0
by: José Joye | last post by:
hello, I have to communicate with a web Service for which I received the WSDL below. When trying to generate the client proxy, it gives me the error (see below). After investigation, I have...
1
by: fabrizio.viggiani | last post by:
I need to send a mail message to an SMTP server. The .net framework provides System.Net.Mail namespace to send an email: - Build a System.Net.Mail.MailMessage and send it using SmtpClient The...
3
by: b. dougherty | last post by:
Greetings all- I am trying to extract subject headers from emails that have been saved as text files. The subject headers are in MIME UTF-8 format, and so they appear like this: subject:...
60
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I prompt a "Save As" dialog for an accepted mime type?...
0
by: comp.lang.php | last post by:
if (!function_exists('mime_content_type_fileinfo')) { /** * Will use {@link http://us2.php.net/fileinfo FileInfo} functions provided within {@link http://pecl.php.net PECL} bundle to return mime...
1
by: comp.lang.php | last post by:
<pre> if (!function_exists('mime_content_type_fileinfo')) { /** * Will use {@link http://us2.php.net/fileinfo FileInfo} functions provided within {@link http://pecl.php.net PECL} bundle to return...
6
by: squishywaffle | last post by:
This has got me somewhat stumped, so I'll throw it up here in hopes that someone has ran into this before. I'm trying to send a MIME package to Esko Backstage. I'm a bit confused as to how to send...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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
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
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.