Send HTML content in email using Python? I can send simple texts or i can send HTML content, but not both at the same time. I used SMTP built in lib in Python
text ='Hi,\n Just for testing"
with open('samplefile.html') as fp:
body = fp.read()
part1 = MIMEText(text,'plain')
part2 = MIMEText(body,'html)
msg.attach(part1)
msg.attach(part2)
Email is sent but only text file is showing in the content and html send as attachement file. If i remove part1 and it only sends HTML file , then I am able to see in the email content.
But not able to see both text and HTML in the body content at once.