Skip to content

Instantly share code, notes, and snippets.

@r1walz
Created August 12, 2020 10:22
Show Gist options
  • Save r1walz/1898aa9449764478ff4b8c18bb2008e9 to your computer and use it in GitHub Desktop.
Save r1walz/1898aa9449764478ff4b8c18bb2008e9 to your computer and use it in GitHub Desktop.
General Script to send emails
[user]
name = Rohit Ashiwal
#email = rohit.ashiwal265@gmail.com
email = rashiwal@studentambassadors.com
[sendemail]
smtpencryption = tls
smtpserverport = 587
smtppass = **your password**
#smtpserver = smtp.gmail.com
#smtpuser = rohit.ashiwal265@gmail.com
smtpserver = smtp.office365.com
smtpuser = rashiwal@studentambassadors.com
Subject: testing
hello world
Thanks
Rohit
Name Email
Rohit Ashiwal rohit.ashiwal265@gmail.com
Rohit Ashiwal rashiwal@cs.iitr.ac.in
Vedant vedron007@gmail.com
import csv
from subprocess import call
from joblib import Parallel, delayed
recipients = []
def send_email(name, email):
call(['git', 'send-email', '--from=Rohit Ashiwal <rashiwal@studentambassadors.com>',
f'--to={name} <{email}>', '--suppress-from', '--confirm=never', 'email.txt'])
with open('recipients.csv', 'r') as file:
reader = csv.DictReader(file)
for row in reader:
recipients.append((row['Name'], row['Email']))
Parallel(n_jobs=50, prefer='threads')(delayed(send_email)(name, email) for (name, email) in recipients)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment