Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > howto send html mails using smtplib

Reply
Thread Tools

howto send html mails using smtplib

 
 
Philippe C. Martin
Guest
Posts: n/a
 
      06-09-2005
Hi,

I have the following problem:
1) I can use smtplib to send text messages
2) I can generate html
3) I want to email the html and want it to be seen by the email client as
html.

However, when I receive the message, the email client displays it as text
(code hereunder) - I assume it has to do with the MIMEText call but since I
cannot see any MIMEhtml .....

Any clue ?

Thanks

Philippe


#************************************************* *******************
def Mail(self,p_data):

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

self.__m_config = Config()

self.__m_config.Load()

me = self.__m_config.dict['ACCOUNT']
#me = '(E-Mail Removed)'
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_text)
msg['To'] = you
msg['Subject'] = self.__m_config.dict['TITLE']
msg['From'] = self.__m_config.dict['FROM']
s.sendmail(me, [you], msg.as_string())
self.__m_list = []

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: smtplib send email by using gmail smtp server Gabriel Genellina Python 0 05-03-2009 06:08 PM
[SMTPLIB] how to send a "Multiline" mail with smtplib? Evan Python 3 06-23-2008 08:50 AM
re: howto send html mails using smtplib Tim Williams Python 1 06-10-2005 01:26 PM
converting Mozilla mails into Outlook Express mails Martin Geers Firefox 1 07-17-2004 01:11 AM
e-mails going to a black hole, or companies that don't reply e-mails Mauricio Freitas NZ Computing 5 02-10-2004 01:21 AM



Advertisments