Skip to content

Commit

Permalink
email sending program
Browse files Browse the repository at this point in the history
  • Loading branch information
rakeshlinux committed May 11, 2018
1 parent 896d03f commit 8036766
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 5 deletions.
Binary file added Multi_threading/alarm.wav
Binary file not shown.
3 changes: 3 additions & 0 deletions Multi_threading/anotherApplication.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import subprocess
subprocess.Popen('C:\\Windows\\System32\\calc.exe')
subprocess.Popen(['C:\\Windows\\notepad.exe', 'C:\\main.cpp'])
9 changes: 9 additions & 0 deletions Multi_threading/countdown.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import time
import subprocess

timeleft =10
while timeleft>0:
print("Time left {}".format(timeleft))
time.sleep(1)
timeleft = timeleft -1
subprocess.Popen(['start', r'C:\Users\acer\Desktop\PythonBox\pythonPrograms\Multi_threading\alarm.wav'], shell=True)
11 changes: 11 additions & 0 deletions Multi_threading/demo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import threading, time
print('Start of program.')

def takeANap():
time.sleep(5)
print('Wake up!')

threadObj = threading.Thread(target=takeANap)
threadObj.start()

print('End of program.')
6 changes: 6 additions & 0 deletions abcd.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Hello Dear,

How are you? I am fine and trying to learn someting using python

Kind regards
rakesh kumar
29 changes: 24 additions & 5 deletions emailsend.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,29 @@
#-------------------------------------------------------------------------------

import smtplib
connection = smtplib.SMTP('smtp.gmail.com',587)
from email.mime.text import MIMEText

# Open a plain text file for reading. For this example, assume that
# the text file contains only ASCII characters.
textfile ="abcd.txt"
fp = open(textfile, 'r')
# Create a text/plain message
msg = MIMEText(fp.read())
fp.close()

me ='rakesh@binarynote.com'
you = 'archana@binarynote.com'

msg['Subject'] = 'The contents of %s' % textfile
msg['From'] = me
msg['To'] = you


connection = smtplib.SMTP_SSL('gator3189.hostgator.com',465)
connection.ehlo()
connection.starttls()
connection.login('rakesh.linux@gmail.com','RAMJI00789')
connection.sendmail('rakesh.linux@gmail.com','rakeysh.kumar@gmail.com','SUBJECT: This is demo \n\n This is a mail from python')
#connection.starttls()
password = input("Enter your password")
connection.login('rakesh@binarynote.com',password)
connection.sendmail(me,[you],msg.as_string())
connection.quit()
print('Email pushed...')
print('\n\n Email pushed...\n\n')

0 comments on commit 8036766

Please sign in to comment.