SMTPlib inside function, extra tab

Hunter hunterji at
Thu Oct 9 04:35:57 CEST 2008

Thank you Tino.  I appreciate the help.

Duh!  Anything inside """ """ is preformatted text.  I have tabs
inside my preformatted text (without even thinking because it looks
more normal because of the indent).  I removed them and voila!

def send_mail(fromaddress,tolist,msgsubj,messagebody):
        import smtplib
        SERVER = ""
        message = """\
From: %s
To: %s
Subject: %s
        """ % (fromaddress, ", ".join(tolist),msgsubj, messagebody)
        print message
        server = smtplib.SMTP(SERVER)
        server.sendmail(fromaddress, tolist, message)


More information about the Python-list mailing list