I am trying to send an email with images to an email address, but I do not know the codes to sent picture emails in this example, can anyone help me out! thank you
using from email.mime.image import MIMEImage doesn't seem to work too on this
Some background information: it's a fitness training program that extracts user email and name to sent it, therefore the
def email_user(email, name):
import smtplib
def email_user(email, name):
fromaddr = 'something@gmail.com'
server = smtplib.SMTP('smtp.gmail.com', 587)
server.ehlo()
server.starttls()
server.login('something@gmail.com', '1234567890')
image = "/Users/Desktop/imagehere.jpeg"
greeting = "\n<p style=\"font-size:30px; text-align: center; color:Red;\"> <b>Amazing Workout " + name + "! </b> </p> <br>"
performance_summary = "\n<p style=\"font-size:20px; text-align: center;\"><b>Here is your Performance Summary<b> for "
message = greeting + performance_summary
server.sendmail(fromaddr, email, message)
def main():
# Test Emailing
email_user("email", "name")
if __name__ == "__main__":
main()