diff --git a/README.md b/README.md index 96e4bb8..b508f60 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,7 @@ So far, the following projects have been integrated to this repo: |--|--| |[File Encrypt Decrypt](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/file-encrypt-decrypt)|[Aditya Arakeri](https://github.com/adityaarakeri)| | [Address locator](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/Location_Of_Adress) | [Chris]() | +| [Automated emails](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/automated_email) | [Suvigya](https://github.com/SuvigyaJain1) | |[AI chatbot](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/Artificial-intelligence_bot) |[umar abdullahi](https://github.com/umarbrowser) | |[Asymmetric Encryption](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/asymmetric_cryptography) |[victor matheus](https://github.com/victormatheusc) | |[Bitcoin price GUI](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/Bitcoin-Price-GUI) |[Amirul Abu](https://github.com/amirulabu) | @@ -101,4 +102,4 @@ Remember to star the repo if you love the scipts~ :wink: - Feel Free to add your script in the [project's list](https://github.com/hastagAB/Awesome-Python-Scripts#what-do-we-have) above. -- One Commit per PR is the Golden Rule. +- One Commit per PR is the Golden Rule. diff --git a/automated_email/README.md b/automated_email/README.md new file mode 100644 index 0000000..357fc0f --- /dev/null +++ b/automated_email/README.md @@ -0,0 +1,13 @@ +#Automated email python script You can now send emails to multiple people at once easily with only a few clicks using smtplib module in Python + +#Requirement Python version 3 and above smtplib json + +```bash +pip install smtplib +pip install json +``` + +Can be run easily using commmand prompt (python automated_email.py) + -> login as you would for your gmail account( same email and password) + -> find your way with the intuitive user friendly menu + (!!!Your passwords and emails are only stored on your local device and no one has access to your information otherwise!!!) diff --git a/automated_email/automated_email.py b/automated_email/automated_email.py new file mode 100644 index 0000000..9a8870d --- /dev/null +++ b/automated_email/automated_email.py @@ -0,0 +1,47 @@ +from smtplib import SMTP as smtp +import json + +def sendmail(sender_add, reciever_add, msg, password): + server = smtp('smtp.gmail.com:587') + server.starttls() + server.login(sender_add, password) + server.sendmail(sender_add, reciever_add, msg) + print("Mail sent succesfully....!") + + +group = {} +print('\t\t ......LOGIN.....') +your_add = input('Enter your email address :') +password = input('Enter your email password for login:') +print('\n\n\n\n') +choice = 'y' +while(choice != '3' or choice != 'no'): + print("\n 1.Create a group\n2.Message a group\n3.Exit") + choice = input() + if choice == '1': + ch = 'y' + while(ch != 'n'): + gname = input('Enter name of group :') + group[gname] = input('Enter contact emails separated by a single space :').rstrip() + ch = input('Add another....y/n? :').rstrip() + with open('groups.json', 'a') as f: + json.dump(group, f) + elif choice == '2': + gname = input('Enter name of group :') + try: + f = open('groups.json', 'r') + members = json.load(f) + f.close() + except: + print('Invalid group name. Please Create group first') + exit + members = members[gname].split() + msg = input('Enter message :') + for i in members: + try: + sendmail(your_add, i, msg, password) + except: + print("An unexpected error occured. Please try again later...") + continue + else: + break diff --git a/automated_email/requirements.txt b/automated_email/requirements.txt new file mode 100644 index 0000000..43b734f --- /dev/null +++ b/automated_email/requirements.txt @@ -0,0 +1,2 @@ +smtplib +json