Most viewed recipes tagged "email"http://code.activestate.com/recipes/tags/email/views/2016-05-27T05:28:21-07:00ActiveState Code RecipesSend HTML or Text email with or without attachments (Python) 2009-07-27T13:14:24-07:00Isaac Wagnerhttp://code.activestate.com/recipes/users/4171255/http://code.activestate.com/recipes/576858-send-html-or-text-email-with-or-without-attachment/ <p style="color: grey"> Python recipe 576858 by <a href="/recipes/users/4171255/">Isaac Wagner</a> (<a href="/recipes/tags/email/">email</a>, <a href="/recipes/tags/smtp/">smtp</a>). </p> <p>Using code gleaned from the net and from my own brain I created this convenient wrapper to send email messages via SMTP in Python. This class allows you to send plain text email messages or HTML encoded messages. You can also add attachments to the messages.</p> Sending Email in Python (Python) 2013-02-24T13:47:01-08:00James Millshttp://code.activestate.com/recipes/users/4167757/http://code.activestate.com/recipes/578472-sending-email-in-python/ <p style="color: grey"> Python recipe 578472 by <a href="/recipes/users/4167757/">James Mills</a> (<a href="/recipes/tags/email/">email</a>, <a href="/recipes/tags/email_sending/">email_sending</a>, <a href="/recipes/tags/sendmail/">sendmail</a>, <a href="/recipes/tags/smtp/">smtp</a>). </p> <p>Every Python Application needs to send email at some point. Whether it's for reporting errors, status updates or simply the core functionality of the system this little recipe should help! Documented and Tested.</p> Sending Email From A Python Program (Python) 2014-01-10T20:13:45-08:00Captain DeadBoneshttp://code.activestate.com/recipes/users/4184772/http://code.activestate.com/recipes/578807-sending-email-from-a-python-program/ <p style="color: grey"> Python recipe 578807 by <a href="/recipes/users/4184772/">Captain DeadBones</a> (<a href="/recipes/tags/email/">email</a>, <a href="/recipes/tags/smtp/">smtp</a>, <a href="/recipes/tags/time/">time</a>). Revision 4. </p> <p>I put together this code for one of my programs and decided to share it. You may never know when you will need you Python Program to send an email to someone. <a href="http://thelivingpearl.com/2014/01/10/sending-email-from-python-using-command-line/">Sending Email From Python</a>. </p> <p>NOTE: You will have to change the account setup variables to your own. The server is currently configured o Gmail, but you can use this script with any server. </p> Shutdown your computer via E-mail - Python (Python) 2016-05-27T05:28:21-07:00Burak Tandoganhttp://code.activestate.com/recipes/users/4191373/http://code.activestate.com/recipes/580668-shutdown-your-computer-via-e-mail-python/ <p style="color: grey"> Python recipe 580668 by <a href="/recipes/users/4191373/">Burak Tandogan</a> (<a href="/recipes/tags/computer/">computer</a>, <a href="/recipes/tags/email/">email</a>, <a href="/recipes/tags/mail/">mail</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/script/">script</a>, <a href="/recipes/tags/shutdown/">shutdown</a>). Revision 2. </p> <p>Shutdown your computer via E-mail.</p> <p>Basically, send an e-mail to your e-mail address SHUTDOWN YOURSELF {YEAR-MONTH-DATE} format in Subject. Your mail's SUBJECT must be in SHUTDOWN YOURSELF {YEAR-MONTH-DATE} format.</p> Sending non-ASCII emails from Python 3 (Python) 2012-09-16T07:50:17-07:00Krystian Rosińskihttp://code.activestate.com/recipes/users/4182314/http://code.activestate.com/recipes/578150-sending-non-ascii-emails-from-python-3/ <p style="color: grey"> Python recipe 578150 by <a href="/recipes/users/4182314/">Krystian Rosiński</a> (<a href="/recipes/tags/email/">email</a>, <a href="/recipes/tags/python3/">python3</a>, <a href="/recipes/tags/smtp/">smtp</a>). Revision 17. </p> <p>Simple Python 3 module for sending emails with attachments through an SMTP server.</p> <p>The module supports non-ASCII characters in sender name, subject, message and file names.</p> send a multipart email via gmail's SMTP server (Python) 2009-12-21T14:29:41-08:00Trent Mickhttp://code.activestate.com/recipes/users/4173505/http://code.activestate.com/recipes/576824-send-a-multipart-email-via-gmails-smtp-server/ <p style="color: grey"> Python recipe 576824 by <a href="/recipes/users/4173505/">Trent Mick</a> (<a href="/recipes/tags/email/">email</a>, <a href="/recipes/tags/gmail/">gmail</a>, <a href="/recipes/tags/smtp/">smtp</a>). Revision 3. </p> <p>This is a Python function to send an email (a) with optional text and html alternative parts and (b) via gmail's SMTP server using your gmail account.</p> Convert text/enriched MIME to text/html (Python) 2009-06-09T15:08:40-07:00Jack Trainorhttp://code.activestate.com/recipes/users/4076953/http://code.activestate.com/recipes/576800-convert-textenriched-mime-to-texthtml/ <p style="color: grey"> Python recipe 576800 by <a href="/recipes/users/4076953/">Jack Trainor</a> (<a href="/recipes/tags/email/">email</a>, <a href="/recipes/tags/html/">html</a>, <a href="/recipes/tags/mime/">mime</a>, <a href="/recipes/tags/text_enriched/">text_enriched</a>). </p> <p>Converts text stream in text/enriched MIME format from file or stdin to text/html output to file or stdout.</p> send a multipart email (Python) 2009-10-15T13:56:10-07:00Trent Mickhttp://code.activestate.com/recipes/users/4173505/http://code.activestate.com/recipes/576931-send-a-multipart-email/ <p style="color: grey"> Python recipe 576931 by <a href="/recipes/users/4173505/">Trent Mick</a> (<a href="/recipes/tags/email/">email</a>, <a href="/recipes/tags/multipart/">multipart</a>, <a href="/recipes/tags/smtp/">smtp</a>). Revision 2. </p> <p>A simple function to send an email (can specify text and html parts).</p> <p>See also: <a href="http://code.activestate.com/recipes/576824/">Recipe 576824</a> (send via Gmail's SMTP server), <a href="http://code.activestate.com/recipes/576858/">Recipe 576858</a> (more complex, but supports attachments).</p> Send Email (Python) 2012-08-26T11:23:54-07:00sfwgeekhttp://code.activestate.com/recipes/users/4170734/http://code.activestate.com/recipes/576807-send-email/ <p style="color: grey"> Python recipe 576807 by <a href="/recipes/users/4170734/">sfwgeek</a> (<a href="/recipes/tags/argparse/">argparse</a>, <a href="/recipes/tags/cli/">cli</a>, <a href="/recipes/tags/command/">command</a>, <a href="/recipes/tags/email/">email</a>, <a href="/recipes/tags/interface/">interface</a>, <a href="/recipes/tags/line/">line</a>, <a href="/recipes/tags/mail/">mail</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/send/">send</a>, <a href="/recipes/tags/smtplib/">smtplib</a>). Revision 5. </p> <p>A Command Line Interface (CLI) program to send email.</p> extract emails from a mbox read on stdin (Python) 2013-09-07T10:24:17-07:00Romain Dartigueshttp://code.activestate.com/recipes/users/4167472/http://code.activestate.com/recipes/576553-extract-emails-from-a-mbox-read-on-stdin/ <p style="color: grey"> Python recipe 576553 by <a href="/recipes/users/4167472/">Romain Dartigues</a> (<a href="/recipes/tags/email/">email</a>, <a href="/recipes/tags/generators/">generators</a>, <a href="/recipes/tags/mbox/">mbox</a>, <a href="/recipes/tags/read_only/">read_only</a>, <a href="/recipes/tags/stdin/">stdin</a>). Revision 2. </p> <p>The Python <code>mailbox.mbox</code> class require a real file to initialize, which was an issue in my case. These simple functions let you iter through a mailbox read from a read-only file descriptor (like <code>sys.stdin</code>).</p> <p>This script use the generators which were introduced in Python-2.2. Let me know if you are interested a similar functionnality on older Python versions.</p> Delete all message older than a given date in a pop account (Python) 2009-10-05T12:56:13-07:00Benjamin Sergeanthttp://code.activestate.com/recipes/users/4039626/http://code.activestate.com/recipes/576922-delete-all-message-older-than-a-given-date-in-a-po/ <p style="color: grey"> Python recipe 576922 by <a href="/recipes/users/4039626/">Benjamin Sergeant</a> (<a href="/recipes/tags/delete/">delete</a>, <a href="/recipes/tags/email/">email</a>, <a href="/recipes/tags/pop/">pop</a>). </p> <p>I was using the keep option in fetchmail, so I had a huge number of emails that seems to slow down mails retrieval / pop connection. I wanted a way to </p> Detach Thunderbird emails and keep links (Python) 2009-05-11T02:38:47-07:00Jice Clavierhttp://code.activestate.com/recipes/users/4089467/http://code.activestate.com/recipes/576749-detach-thunderbird-emails-and-keep-links/ <p style="color: grey"> Python recipe 576749 by <a href="/recipes/users/4089467/">Jice Clavier</a> (<a href="/recipes/tags/detach/">detach</a>, <a href="/recipes/tags/email/">email</a>, <a href="/recipes/tags/thunderbird/">thunderbird</a>). </p> <p>For some people, thunderbird lacks of a powerfull automatic detach function that keeps the link to the detached file from the mail itself (like Eudora has). Some plugins exists but there is now way to detach a document and replace it with a link to it's new location. For security reasons, the developper team doesn't want to allow the opening of a local file from thunderbird. When you have to keep large history of your emails, this may become a real problem for the size of your box and the facilities to automate some tasks on files (you can't use programs to see if you have doubles and so on). If, like me, you want to keep your email box as slim as possible by detaching attached documents and keep links to the detached files, this may be for you.</p> <p>The trick is that the file is detached and replaced by an html one in which you'll find the link to the file. The html file will be opened in your browser where the link to your local filesystem will operate.</p> retrieving emails from POP3 server (Python) 2010-03-19T09:18:45-07:00Shamil Bikineyevhttp://code.activestate.com/recipes/users/4173185/http://code.activestate.com/recipes/577127-retrieving-emails-from-pop3-server/ <p style="color: grey"> Python recipe 577127 by <a href="/recipes/users/4173185/">Shamil Bikineyev</a> (<a href="/recipes/tags/email/">email</a>). </p> <p>poplib utils (retr_text, retr_msg, ..) that useful while working with POP3 server</p> handling embedded email images in python (Python) 2011-10-26T15:31:45-07:00Simeon Shpizhttp://code.activestate.com/recipes/users/4178609/http://code.activestate.com/recipes/577923-handling-embedded-email-images-in-python/ <p style="color: grey"> Python recipe 577923 by <a href="/recipes/users/4178609/">Simeon Shpiz</a> (<a href="/recipes/tags/appengine/">appengine</a>, <a href="/recipes/tags/email/">email</a>, <a href="/recipes/tags/embedded_image/">embedded_image</a>, <a href="/recipes/tags/python/">python</a>). Revision 2. </p> <p>this code finds all embedded images in the email and replaces them with an appropriate img tag.</p> working with an email's headers (Python) 2010-03-19T09:32:05-07:00Shamil Bikineyevhttp://code.activestate.com/recipes/users/4173185/http://code.activestate.com/recipes/577128-working-with-an-emails-headers/ <p style="color: grey"> Python recipe 577128 by <a href="/recipes/users/4173185/">Shamil Bikineyev</a> (<a href="/recipes/tags/email/">email</a>, <a href="/recipes/tags/header/">header</a>). </p> <p>email utils (decode_header, get_header, parseaddr, formataddr) that useful while working with an email's parts</p> handling embedded email images in python (Python) 2012-03-02T12:43:51-08:00Gregory Nicholashttp://code.activestate.com/recipes/users/4180332/http://code.activestate.com/recipes/578058-handling-embedded-email-images-in-python/ <p style="color: grey"> Python recipe 578058 by <a href="/recipes/users/4180332/">Gregory Nicholas</a> (<a href="/recipes/tags/appengine/">appengine</a>, <a href="/recipes/tags/email/">email</a>, <a href="/recipes/tags/embedded_image/">embedded_image</a>, <a href="/recipes/tags/python/">python</a>). </p> <p>this code finds all embedded images in the email and replaces them with an appropriate img tag.</p>