smtplib - Email using Python with Excel attachment -
#!/usr/bin/env python3 import smtplib,email,email.encoders,email.mime.text,email.mime.base email.mime.multipart import mimemultipart email.mime.text import mimetext email import encoders email.message import message email.mime.audio import mimeaudio email.mime.base import mimebase email.mime.image import mimeimage email.mime.multipart import mimemultipart email.mime.text import mimetext msg = mimemultipart() # me == email address # == recipient's email address me = "sender@email.com" = "reciever@email.com " # create message container - correct mime type multipart/alternative. msg = mimemultipart('mixed') msg['subject'] = "msg" msg['from'] = me msg['to'] = # create body of message (a plain-text , html version). text = "hi\nthis text-only" html = """\ <html> email</html> """ part1 = mimetext(text, 'plain') part2 = mimetext(html, 'html') #attach exc...