I'm trying to combine a plain string and some HTML code to the same content of the Email message.
I wrote my code as follow: from email.mime.text import MIMEText
import smtplib
from email.mime.multipart import MIMEMultipart
fromaddr = SMTP_Connection[2]
# MIMEMultipart
msg = MIMEMultipart()
# senders email address
msg ['From'] = fromaddr
# receivers email address
msg ['To'] = "dummy1@email.com"
# the subject of mail
msg ['Subject'] = title
#Add Logo
logo= "<html></html>"
# the body of the mail
msg.attach(MIMEText(message,'plain'))
msg.attach(MIMEText(logo,'html'))
smtpObj.sendmail ( fromaddr ,emails, msg.as_string() )
But when the message is coming to the inbox mail the plain text is shown in the body of the message but the HTML code attaching as an attached file.
What I didn't right?