I’m using smtplib to send emails through Python, everything’s well and works fine, but is there a way to send HTML formatted content as the message instead of the strings? More importantly, what I’m trying to do is send links and make them unclickable, so that people won’t accidentally click and open them.
This is how I’m formulating my email message:
message = "From: %s\r\n" % fromaddr+ "To: %s\r\n" % toaddrs+ "CC: %s\r\n" % ",".join(cc)+ "Subject: %s\r\n" % message_subject+ "\r\n" + "Reanalyze this URL: " +msg+"\r\nLabelled as "+blueContent
Python’s standard library email package is for such tasks. For composing email messages use
email.message.Message class.