On 27 Jun 2005 15:38:59 -0700, rumours say that "Inkiniteo"
<[EMAIL PROTECTED]> 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?""" % (from_whom,
", ".join(to_whom_list))

I tried it as

send('localhost', '[EMAIL PROTECTED]', ['[EMAIL PROTECTED]'])

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
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to