mirror of
https://github.com/metafy-social/python-scripts.git
synced 2025-01-18 07:17:03 +00:00
add: Email Sender Script
This commit is contained in:
parent
58847d3648
commit
df8072b185
40
Email Sender/README.md
Normal file
40
Email Sender/README.md
Normal file
|
@ -0,0 +1,40 @@
|
|||
## Check-System-Usage
|
||||
|
||||
![built by developers](http://ForTheBadge.com/images/badges/built-by-developers.svg)
|
||||
![python](https://img.shields.io/badge/language-Python-orange?style=for-the-badge)
|
||||
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg?style=plasitc)](https://github.com/psf/black)
|
||||
![License](https://img.shields.io/github/license/GDSC-RCCIIT/General-Purpose-Scripts?color=blue&style=plasitc)
|
||||
|
||||
### About
|
||||
|
||||
A Python3 script to automate the email sending process
|
||||
|
||||
### Setup
|
||||
|
||||
* Install Python3 for Windows from [here](https://python.org).
|
||||
* Open Windows Command Prompt
|
||||
* Clone the repository
|
||||
```bash
|
||||
git clone https://github.com/GDSC-RCCIIT/General-Purpose-Scripts.git
|
||||
```
|
||||
* Navigate inside the ```scripts\Email-Sender``` directory.
|
||||
```bash
|
||||
cd General-Purpose-Scripts\scripts\Email-Sender
|
||||
```
|
||||
* Run using Python
|
||||
```bash
|
||||
python system-usage.py
|
||||
```
|
||||
Note: Make sure you have enabled the "Less Secure Apps" from Google account security
|
||||
to send emails using that script.
|
||||
|
||||
### Steps to Allow Less Secure Apps
|
||||
|
||||
* Visit: https://myaccount.google.com/intro/security
|
||||
* Disable 2-Step Verification if enabled (See the image below).
|
||||
![Screenshot (504)](https://user-images.githubusercontent.com/73809690/135844785-6bb4aaf1-b647-4d79-aa1d-742117a8547e.png)
|
||||
|
||||
* Then Turn On Less Secure Apps (See the image below)
|
||||
![Screenshot (505)](https://user-images.githubusercontent.com/73809690/135844893-43e10b99-2a84-4637-af4b-192afb8c1e4d.png)
|
||||
|
||||
* Now you are good to go.
|
22
Email Sender/script.py
Normal file
22
Email Sender/script.py
Normal file
|
@ -0,0 +1,22 @@
|
|||
# Script to automate Email Sending
|
||||
"""Note: To run this script enable "Less Secure Apps" shown in Readme file"""
|
||||
import smtplib
|
||||
|
||||
to = input("Enter the Email of recipent:\n")
|
||||
content = input("Enter the Content for E-Mail:\n")
|
||||
|
||||
sender_email = input("Enter Your Email Address: ")
|
||||
sender_password = input("Enter Your Password: ")
|
||||
|
||||
|
||||
def sendEmail(to, content):
|
||||
server = smtplib.SMTP("smtp.gmail.com", "587")
|
||||
server.ehlo()
|
||||
server.starttls()
|
||||
server.login(sender_email, sender_password)
|
||||
server.sendmail(sender_email, to, content)
|
||||
server.close()
|
||||
print("Email Successfully send\n")
|
||||
|
||||
|
||||
sendEmail(to, content)
|
Loading…
Reference in New Issue
Block a user