[Tutor] How to print out multiple lines

Sheila King sheila@thinkspot.net
Sun, 07 Jan 2001 21:16:35 -0800

On Sun, 7 Jan 2001 14:05:15 -0800 (PST), Daniel Yoo
<dyoo@hkn.eecs.berkeley.edu>  wrote about Re: [Tutor] How to print out
multiple lines:

:Hmmm... that's a bug!  I needed to add newlines between the
:concatentations.  I think you should be able to fix this ok.
:Hope this helps!

Yes, thanks very much. It helped a great deal. Here is my final code:

import smtplib

def readManyLines():
    """Read lines from the user until they enter a line with a single
period, and return a single string."""
    result = ""
    while 1:
        line = raw_input()
        if line == '.': return result
        result = result + line + "\n"

servername=raw_input("SMTP server name: ")
Fromaddress=raw_input("From address: ")
Toaddress=raw_input("To address: ")
print "Enter your message. To end, enter a line that begins with a"
print "period and has no other characters: "
server.sendmail(Fromaddress, Toaddress, MessageText)

I was able to run that on a DOS prompt, and send out e-mails with it. Great.
Now I'm getting ready to start working with input from files. My goal is to
write some mail filtering scripts to use on my web hosting site, to
automatically forward certain e-mails to Spamcop.net. (When I get this figured
out, I'm planning to get an account with them.)

I have other projects up my sleeve, too. But that's the first one.

Sheila King