<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel>
    <title>'Code up email message in Python' Thread RSS Feed</title>
    <link>http://www.programmersheaven.com/</link>
    <description>Contains the latest posts from the thread 'Code up email message in Python' posted on the 'Python' forum at Programmer's Heaven.</description>
    <language>en</language>
    <copyright>Copyright 2013 Programmers Heaven</copyright>
    <pubDate>Tue, 18 Jun 2013 14:03:54 -0700</pubDate>
    <lastBuildDate>Tue, 18 Jun 2013 14:03:54 -0700</lastBuildDate>
    <generator>Argotic Syndication Framework 2007.3.0.1, http://www.codeplex.com/Argotic</generator>
    <docs>http://www.rssboard.org/rss-specification</docs>
    <ttl>360</ttl>
    <image>
      <url>http://www.programmersheaven.com/images/ph.gif</url>
      <title>Programmers Heaven</title>
      <link>http://www.programmersheaven.com/</link>
      <width>88</width>
      <height>31</height>
    </image>
    <item>
      <title>Code up email message in Python</title>
      <link>http://www.programmersheaven.com/mb/python/142509/142509/code-up-email-message-in-python/</link>
      <description>&lt;strong&gt;&lt;span style="color: Red;"&gt;This message was edited by Bonkers at  2002-10-2 1:24:59&lt;/span&gt;&lt;/strong&gt;&lt;hr /&gt;&lt;br /&gt;
&lt;br /&gt;
Hi,&lt;br /&gt;
Have a task from my teacher: "Send me an email made by Python"&lt;br /&gt;
Ok, cool!&lt;br /&gt;
Plz direct me somewhere to find this code module!!!!!!!!&lt;br /&gt;
Cheers, Bonkers &lt;img src="http://www.programmersheaven.com/images/Community/smile.gif" width="15" height="15" alt="" /&gt;&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/python/142509/142509/code-up-email-message-in-python/</guid>
      <pubDate>Wed, 02 Oct 2002 01:22:29 -0700</pubDate>
      <category>Python</category>
    </item>
    <item>
      <title>Re: Code up email message in Python</title>
      <link>http://www.programmersheaven.com/mb/python/142509/157587/re-code-up-email-message-in-python/#157587</link>
      <description>: &lt;strong&gt;&lt;span style="color: Red;"&gt;This message was edited by Bonkers at  2002-10-2 1:24:59&lt;/span&gt;&lt;/strong&gt;&lt;hr /&gt;&lt;br /&gt;
: &lt;br /&gt;
: Hi,&lt;br /&gt;
: Have a task from my teacher: "Send me an email made by Python"&lt;br /&gt;
: Ok, cool!&lt;br /&gt;
: Plz direct me somewhere to find this code module!!!!!!!!&lt;br /&gt;
: Cheers, Bonkers &lt;img src="http://www.programmersheaven.com/images/Community/smile.gif" width="15" height="15" alt="" /&gt;&lt;br /&gt;
&lt;br /&gt;
You can read "email" module and find informations about sending email.&lt;br /&gt;
This code use "smtplib" and is taken from Python tutorial. Try this:&lt;br /&gt;
&lt;br /&gt;
import smtplib&lt;br /&gt;
import string&lt;br /&gt;
&lt;br /&gt;
def prompt(prompt):&lt;br /&gt;
    return raw_input(prompt).strip()&lt;br /&gt;
&lt;br /&gt;
fromaddr = prompt("From: ")&lt;br /&gt;
toaddrs  = prompt("To: ").split()&lt;br /&gt;
print "Enter message, end with ^D:"&lt;br /&gt;
&lt;br /&gt;
# Add the From: and To: headers at the start!&lt;br /&gt;
msg = ("From: %s\r\nTo: %s\r\n\r\n"&lt;br /&gt;
       % (fromaddr, string.join(toaddrs, ", ")))&lt;br /&gt;
while 1:&lt;br /&gt;
    try:&lt;br /&gt;
        line = raw_input()&lt;br /&gt;
    except EOFError:&lt;br /&gt;
        break&lt;br /&gt;
    if not line:&lt;br /&gt;
        break&lt;br /&gt;
    msg = msg + line&lt;br /&gt;
&lt;br /&gt;
print "Message length is " + `len(msg)`&lt;br /&gt;
&lt;br /&gt;
server = smtplib.SMTP('localhost')&lt;br /&gt;
server.set_debuglevel(1)&lt;br /&gt;
server.sendmail(fromaddr, toaddrs, msg)&lt;br /&gt;
server.quit()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/python/142509/157587/re-code-up-email-message-in-python/#157587</guid>
      <pubDate>Tue, 03 Dec 2002 06:40:52 -0700</pubDate>
      <category>Python</category>
    </item>
  </channel>
</rss>