mime

Send a mail via Python with a csv files

Send a mail via Python with a csv files Question: I have a probleme, this code works couple weeks ago but doesn’t works now and i don’t know why: from email.mime.application import MIMEApplication from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText import smtplib def send_email(send_to, subject, df): send_from = "***" password = "***" message = …

Total answers: 2

Changing the name that is displayed when sending an email through python?

Changing the name that is displayed when sending an email through python? Question: I am going to send an email to a bunch of people listed in a .csv containing a html image using python. I have got this to work fine using the code snippet below, however when it has sent, it appears in …

Total answers: 2

SMTPlib Attachments not received

SMTPlib Attachments not received Question: I’ve been using code based on the snippet at http://datamakessense.com/easy-scheduled-emailing-with-python-for-typical-bi-needs/ to send PDF attachments to customers through my company’s email. We send about 100 of these at a time, through a single email address (“[email protected]”), and for each email sent, I send a BCC copy to an internal email address, …

Total answers: 2

Python email lib – How to remove attachment from existing message?

Python email lib – How to remove attachment from existing message? Question: I have an email that I’m reading with the Python email lib that I need to modify the attachments of. The email Message class has the “attach” method, but does not have anything like “detach”. How can I remove an attachment from a …

Total answers: 4

How can I get an email message's text content using Python?

How can I get an email message's text content using Python? Question: Given an RFC822 message in Python 2.6, how can I get the right text/plain content part? Basically, the algorithm I want is this: message = email.message_from_string(raw_message) if has_mime_part(message, “text/plain”): mime_part = get_mime_part(message, “text/plain”) text_content = decode_mime_part(mime_part) elif has_mime_part(message, “text/html”): mime_part = get_mime_part(message, “text/html”) …

Total answers: 5

Sending Multipart html emails which contain embedded images

Sending Multipart html emails which contain embedded images Question: I’ve been playing around with the email module in python but I want to be able to know how to embed images which are included in the html. So for example if the body is something like <img src=”../path/image.png”></img> I would like to embed image.png into …

Total answers: 5

How to find the mime type of a file in python?

How to find the mime type of a file in python? Question: Let’s say you want to save a bunch of files somewhere, for instance in BLOBs. Let’s say you want to dish these files out via a web page and have the client automatically open the correct application/viewer. Assumption: The browser figures out which …

Total answers: 18