By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,002 Members | 1,171 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,002 IT Pros & Developers. It's quick & easy.

howto send html mails using smtplib

P: n/a

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

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 ?


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

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

self.__m_config = Config()


me = self.__m_config.dict['ACCOUNT']
#me = 'p**************'
host = self.__m_config.dict['SMTP']
s = smtplib.SMTP()

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 = []

Jul 19 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.