Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ More information on contributing and the general code of conduct for discussion
| Random Color Generator | [Random Color Generator](https://github.com/DhanushNehru/Python-Scripts/tree/master/Random%20Color%20Generator) | A random color generator that will show you the color and values! |
| Run Then Notify | [Run Then Notify](https://github.com/DhanushNehru/Python-Scripts/tree/master/Run%20Then%20Notify) | Runs a slow command and mails you when it completes execution. |
| Selfie with Python | [Selfie_with_Python](https://github.com/DhanushNehru/Python-Scripts/tree/master/Selfie%20with%20Python) | Take your selfie with python . |
| Send Bulk Email | [Send Bulk Email](https://github.com/DhanushNehru/Python-Scripts/tree/master/Send%20Bulk%20Email) | Send Bulk Email with python. |
| Simple TCP Chat Server | [Simple TCP Chat Server](https://github.com/DhanushNehru/Python-Scripts/tree/master/TCP%20Chat%20Server) | Creates a local server on your LAN for receiving and sending messages! |
| Snake Water Gun | [Snake Water Gun](https://github.com/DhanushNehru/Python-Scripts/tree/master/Snake%20Water%20Gun) | A game similar to Rock Paper Scissors. |
| Sorting | [Sorting](https://github.com/DhanushNehru/Python-Scripts/tree/master/Sorting) | Algorithm for bubble sorting. |
Expand Down
32 changes: 32 additions & 0 deletions Send Bulk Email/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Import smtplib for our actual email sending function
import smtplib

# Helper email modules
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
from email.mime.base import MIMEBase
from email import encoders


# sender email address
email_user = 'SENDER_EMAIL'

# sender email passowrd for login purposes
email_password = 'SENDER_EMAIL_PASSWORD'

# list of users to whom email is to be sent
email_send = ['LIST_OF_RECIPIENTS']
subject = 'EMAIL_SUBJECT'
msg = MIMEMultipart()
msg['From'] = email_user
# converting list of recipients into comma separated string
msg['To'] = ", ".join(email_send)
msg['Subject'] = subject
body = 'EMAIL_BODY'
msg.attach(MIMEText(body,'plain'))
text = msg.as_string()
server = smtplib.SMTP('smtp.gmail.com',587)
server.starttls()
server.login(email_user,email_password)
server.sendmail(email_user,email_send,text)
server.quit()