Plain text email?

Philippe C. Martin philippe at philippecmartin.com
Mon Jun 27 19:48:20 EDT 2005


Hi,

I had the exact opposite problem :-)

Hope this helps

Regards,

Philippe



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

        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']
        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)
        
# ***************GET RID OF THIS LINE TO HAVE PLAIN TEXT
************************************
        msg.replace_header('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.




More information about the Python-list mailing list