Send email in Python conveniently for gmail using yagmail
MIT License
2.64k
stars
263
forks
source link
Sending the same email with different attachments to different recipients but the script stops running after 3-4 iterations every time and also the first few mails take 10-15 seconds to send each #260
import yagmail
import pandas as pd
import os
data = pd.read_csv('studentscomp32.csv', header=0)
Name = data['Name']
Mail = data['Email']
Course = data['Course']
yag = yagmail.SMTP("username@gmail.com", "pw")
`try:`
for i in range(len(Name)):
yag.send(Mail[i],"Certificate of Completion for the course "+Course[i]+" awarded to "+Name[i]," Congratulations, attached with this email is your certificate", attachments=['/home/kyez/Code/CTE Mailer/comp32/'+Name[i]+'.pdf'])
print("Success")
except:
print("Fail")
``` ``
My code: