473,659 Members | 3,239 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Plain text email?

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.

Jul 19 '05 #1
11 4950
On 27 Jun 2005 15:38:59 -0700, Inkiniteo <ga****@gmail.c om> wrote:
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.


Can you give a short example of how you are building the email ?
Jul 19 '05 #2
On 27 Jun 2005 15:38:59 -0700, rumours say that "Inkiniteo"
<ga****@gmail.c om> 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(se rver)
smtp.sendmail(f rom_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 ', 't***@sil-tec.gr', ['t***@sil-tec.gr'])

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
Jul 19 '05 #3
On 27 Jun 2005 15:38:59 -0700, rumours say that "Inkiniteo"
<ga****@gmail.c om> 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(se rver)
smtp.sendmail(f rom_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 ', 't***@sil-tec.gr', ['t***@sil-tec.gr'])

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
Jul 19 '05 #4
Humm. I just create the message this way:

message = 'Serie:\t\t' + str(type) + str(series) + \
'\t\t\tUbicació n:\t\t\t' + place + '\n' + \
'Date&Time:\t' + date

and send it with:
message = header + message
server = smtplib.SMTP('l ocalhost')
server.sendmail ('e****@email.c om', email, message)
server.quit()

Jul 19 '05 #5
On 27 Jun 2005 16:09:38 -0700, rumours say that "Inkiniteo"
<ga****@gmail.c om> might have written:
Humm. I just create the message this way: message = 'Serie:\t\t' + str(type) + str(series) + \
'\t\t\tUbicació n:\t\t\t' + place + '\n' + \
'Date&Time:\t' + date and send it with:
message = header + message
server = smtplib.SMTP('l ocalhost')
server.sendmai l('e****@email. com', email, message)
server.quit( )


And what goes wrong when you see the message? (BTW you don't have a
newline before "Ubicación: "; is it intentional?)

Tabs are infamous confusers of email clients, unfortunately.
--
TZOTZIOY, I speak England very best.
"Dear Paul,
please stop spamming us."
The Corinthians
Jul 19 '05 #6
Hi,

I had the exact opposite problem :-)

Hope this helps

Regards,

Philippe

#************** *************** *************** *************** *********
def Mail(self,p_dat a): #data is string of text

you = wx.GetTextFromU ser('EMAIL ADDRESS','ID')
if len(you) == 0:
return

self.__m_config = Config()

self.__m_config .Load()

me = self.__m_config .dict['ACCOUNT']
host = self.__m_config .dict['SMTP']
s = smtplib.SMTP()
s.connect(host)
s.login(me,self .__m_config.GPW ())

the_text = p_data
msg = MIMEText(the_te xt)

# *************** GET RID OF THIS LINE TO HAVE PLAIN TEXT
*************** *************** ******
msg.replace_hea der('Content-Type', 'text/html')
# *************** GET RID OF THIS LINE TO HAVE PLAIN TEXT
*************** *************** ******
#msg.add_header ('Content-Type', 'text/html')

msg['To'] = you
msg['Subject'] = self.__m_title
msg['From'] = self.__m_config .dict['FROM']
s.sendmail(me, [you], msg.as_string() )
self.__m_list = []

Inkiniteo wrote:
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.


Jul 19 '05 #7
"Inkiniteo" <ga****@gmail.c om> wrote in message
news:11******** *************@z 14g2000cwz.goog legroups.com...
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.
As long as your mimetype is text/plain you should have
minimal trouble. There's no way you can control what
the recipient's mail client does, however.

In particular, there are a lot of mail clients out there that
handle tabs poorly. Outlook Express is the poster child
for this: it ignores tabs completely, however it is by no
means the only culprit. It's simply the most widespread one.

In other words, use strings of spaces rather than tabs,
and you'll probably find your messages coming out
looking better.

John Roth


Jul 19 '05 #8
I see. So... what about sending HTML email? If i send HTML tagged text,
the client will be able to read it as HTML?

For example, if i send an email with: <header></header> <body>
<b>Yo!</></body> will the client read a bold Yo! ?

Because i can replace tabs with tables if this is possible.

Jul 19 '05 #9
On 27 Jun 2005 18:56:27 -0700,
"Inkiniteo" <ga****@gmail.c om> wrote:
I see. So... what about sending HTML email? If i send HTML tagged
text, the client will be able to read it as HTML? For example, if i send an email with: <header></header> <body>
<b>Yo!</></body> will the client read a bold Yo! ?


That depends on the client.

IMO, HTML belongs on web pages, not in email. YMMV.

Regards,
Dan

--
Dan Sommers
<http://www.tombstoneze ro.net/dan/>
Jul 19 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
4171
by: J. Alan Rueckgauer | last post by:
Hello. I'm looking for a simple way to do the following: We have a database that serves-up content to a website. Some of those items are events, some are news articles. They're stored in the DB as formatted HTML so ASP just drops them right into a page shell. Now, we want to send out a newsletter email containing some of those items. No problem sending as HTML. However, some of the members want just plain text. Is there some magic...
14
6866
by: Akseli Mäki | last post by:
Hi, Hopefully this is not too much offtopic. I'm working on a FAQ. I want to make two versions of it, plain text and HTML. I'm looking for a tool that will make a plain text doc out of the HTML doc. The HTML version doesn't have anything fancy, just internal links. So the tool must be able to delete internal links and anchors from the HTML version, but leave external links in simplified form. That is, the HTML version would say <a...
8
5295
by: LRW | last post by:
I'm not sure this message is totally appropriate for this group, so please, if anyone has a better group suggestion, let me know! My company sends out a monthly newsletter in HTML format to our account holders. We get a couple of people with auto-responders saying they don't accept HTML e-mails, please send plain-text. Is there some way to format an e-mail with both versions, maybe defaulting to HTML format but display plain-text if it...
2
6386
by: gRizwan | last post by:
Hello all. can any one tell how can we receive POST data in a ASP form with enctype="text/plain" ? thanks. Riz
2
3404
by: Peter Nilsson | last post by:
In a post regarding toupper(), Richard Heathfield once asked me to think about what the conversion of a char to unsigned char would mean, and whether it was sensible to actually do so. And pete has raised a doubt in my mind on the same issue. Either through ignorance or incompetence, I've been unable to resolve some issues. 6.4.4.4p6 states...
7
1704
by: toby989 | last post by:
Hi All Sorry for reposting...the entries of the post from 11/23/2005 by Eric Lindsay have been removed from the server already and I am seeing only the header. So, I have the problem of including via SSI a plain text fixed width table (separated by spaces) which of course gets treated as html when doing that. I would like to have the blanks (and line returns) stay in the file and then I could use courier new to display it properly. I
6
2126
by: monomaniac21 | last post by:
hi all how can u send a plain text version of an email with the html so that the users mail client can access this plain text version? kind regards marc
0
1869
by: Rey | last post by:
Howdy all. Am using visual web developer 2005 (vb), xp pro sp2. In testing of the system.net.mail to send email from an aspx page where I'm pulling the email contents from a textbox, find that if I mix plain text with html formatted text and set the isBodyHTML = true that I get a continuous line of plain text without carriage returns and proper HTML. I've a checkbox that if checked sets the IsBodyHTML=true.
0
3255
by: lundmark | last post by:
When I send a plain-text message using Outook 2007, I want hard line breaks to be added to my outgoing message. I cannot seem to make this happen. I have configured Outlook to Automatically wrap text at 69 characters on Tools | Options | Mail Format | Internet Format | Plain text options. Outlook does not seem to honor this setting. I tried various different encodings for the message including US-ASCII. On advice from a Microsoft page...
0
8428
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8335
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8851
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8747
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8528
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8627
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5649
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2752
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1976
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.