python - Beautiful table alignment out when sending table with email -


my table printing fine in console when email alignment gets distorted bit, suggestion how send perfectly, printing in console?

from beautifultable import beautifultable email.mime.multipart import mimemultipart email.mime.text import mimetext email.mime.base import mimebase email import encoders import smtplib table = beautifultable() a= ["name", "age", "class"] b=["jacob", 1, "boy"]  table.column_headers =a table.append_row(b) print table  def mailfunction(table):       fromaddr = "sender@gmail.com"     toaddr = "receiver@gmail.com"     msg = mimemultipart()      msg['from'] = fromaddr     msg['to'] = toaddr      msg['subject'] = " table print"      body = str(table)      msg.attach(mimetext(body, 'plain'))     server = smtplib.smtp('smtp.gmail.com:587')     server.starttls()     server.login(fromaddr, "password")     text = msg.as_string()     server.sendmail(fromaddr, toaddr, text)     server.quit()   mailfunction(table) 

console output:

+-------+-----+-------+ | name  | age | class | +-------+-----+-------+ | jacob |  1  |  boy  | +-------+-----+-------+ 

email output:

enter image description here

but when copy email notepad alignments normal


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -