mirror of
https://github.com/metafy-social/python-scripts.git
synced 2025-02-27 18:38:42 +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
|
||||
|
||||

|
||||

|
||||
[](https://github.com/psf/black)
|
||||

|
||||
|
||||
### 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).
|
||||

|
||||
|
||||
* Then Turn On Less Secure Apps (See the image below)
|
||||

|
||||
|
||||
* 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…
x
Reference in New Issue
Block a user