Merge pull request #49 from kapurm17/added_mailing_script

Added mailing script for gmail users
This commit is contained in:
Ayush Bhardwaj 2018-11-14 18:20:34 +05:30 committed by GitHub
commit ed0ded64cd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 43 additions and 0 deletions

40
mailing/gmail_messenger.py Executable file
View File

@ -0,0 +1,40 @@
#!/usr/bin/env python3
import smtplib #import stmplib
try:
server = smtplib.SMTP("smtp.gmail.com", 587) #establshing server connection
server.ehlo()
server.starttls()
print("SERVER CONNECTED")
except:
print("Could Not connect to Gmail") #in case of failure
user = input("Enter User id\n") #YOUR ID
Pass_w = input("\nEnter your Password\n") #YOUR Password
reciever_id = input("\nEnter reciever id\n") #Reciever ID
msg = input("\nEnter message\n") #message
try:
server.login(user, Pass_w) #user log in
print("User Logged in")
except:
print("Allow Less secure apps in GOOGLE ACCOUNT SETTINGS to use SMTP services")
server.quit()
exit()
server.sendmail(user, reciever_id, msg)
print("MAIL sent") #confirmation
print("Closing Connection")
server.quit() #closing server connection
print("Server closed")

3
mailing/read_me.md Normal file
View File

@ -0,0 +1,3 @@
For linux/unix users :
./gmail_messenger.py