I have a script on my raspberry pi in python that sends an email to me containing whatever message i want. But i want to add to the email a photo or video attachment. any ideas how to go about doing this?? I am very new and being very specific would help. THANKS!
here is the code:
import smtplib
smtpUser = 'myemail@gmail.com'
smtpPass= 'mypassword'
toAdd='EmailAddressIamsendingTo'
fromAdd=smtpUser
subject = 'pythonTest'
header = 'to:' + toAdd + '\n' + 'From: ' + fromAdd + '\n' + 'Subject: ' + subject
body='@From within a python script'
print header + '\n' + body
s.ehlo()
s.strattls()
s.ehlo()
s.login(smtpUser, smtpPass)
s.sendmail(fromAdd, toAdd, header + '\n\n' + body)
s.quit()
The current code above works, so if there r mistakes they r probably typos.




