Plain text email?

Christos TZOTZIOY Georgiou tzot at
Tue Jun 28 01:02:56 CEST 2005

On 27 Jun 2005 15:38:59 -0700, rumours say that "Inkiniteo"
<gaz082 at> might have written:

>Hi guys. I have a script that sends the info by email, but i'd like to
>avoid the convertion to HTML by the email client or Gmail, because it
>ruins all the formatting i did (with tabs, mostly). Briefing, i wanna
>be able to send SMTP mail  and the receiver only get it in plain text.

Please tell us what you do more precisely:

* do you send the "info" as an attachment using the email package?
* do you create alternative text and HTML parts for the body?

I have never managed to send plain text email and receive it as HTML.
Perhaps you mean that some "smart" client does something stupid with
your text, eg. it removes line-breaks you have in your message?

Try this:

import smtplib

def send(server, from_whom, to_whom_list):
    smtp = smtplib.SMTP(server)
    smtp.sendmail(from_whom, to_whom_list,
"""From: %s
To: %s
Subject: test email

This is a test.
It has line breaks.
Does it come as three separate lines?""")

I tried it as

send('localhost', 'tzot at', ['tzot at'])

and I had no problem.  What happens for you (substitute other server and
email addresses, obviously :) ?
TZOTZIOY, I speak England very best.
"Dear Paul,
please stop spamming us."
The Corinthians

More information about the Python-list mailing list