Skip to content

Commit

Permalink
Sub-Folder on GitHub
Browse files Browse the repository at this point in the history
For the We Watch Program
  • Loading branch information
MGodfrey50 committed Feb 11, 2019
1 parent 55ad417 commit 839e221
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
1 change: 1 addition & 0 deletions Laser-Door/ReadMe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"# Laser-Door"
43 changes: 43 additions & 0 deletions Send eMail/sendeMail.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import smtplib
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
from email.mime.base import MIMEBase
from email import encoders

# This function attaches and picture and emails.
# Required parameters are email_user (sender), email_rec (recipient), subject and filename
# the filename includes the path

# These parameters will be passed by the main program when it's assembled
email_user = '[email protected]'
email_rec = '[email protected]'
msg_body = 'Hi There, sending email from Python'
filename ='c:\Coding\Send eMail\IMG_1673.JPG'
subject = 'Generated by RPi Camera'

def Send_eMail(email_filename, email_to ,email_from, email_subject):
msg=MIMEMultipart()
msg['To']=email_to
msg['From'] =email_from
msg['Subject'] = email_subject

attachment = open(email_filename, 'rb')
part = MIMEBase ('application', 'octet-stream')
part.set_payload((attachment).read())
encoders.encode_base64(part)
part.add_header('Content-Disposition', "attachment; filename ="+filename)

msg.attach(part)
msg.attach(MIMEText(msg_body,'plain'))
text=msg.as_string()

server = smtplib.SMTP('smtp.live.com',587)
server.starttls()
server.login(email_from, "1million!")

server.sendmail(email_from, email_to,text)
server.quit()



Send_eMail(filename, email_rec,email_user,subject)

0 comments on commit 839e221

Please sign in to comment.