I am using Sendgrid to send out emails to specific departments but I want the email to include data from a csv file. From my understanding, Sendgrid works with HTML. How would it be possible to scrape a csv file and send it using Sendgrid?
message = Mail(
from_email='noreply@gmail.com',
to_emails='test@gmail.com',
subject='New User CAF',
html_content= """<p>This is to inform IT that {Employee Name} will be starting at {PC} on {Effective Date}. Their supervisor is {Supervisor} and their manager is {Manager 2 Name}. Their title is {Title}.</br>
</br>
Office 365: {O365}</br>
Laptop: {Computer}
""")
with open("contacts.csv") as file:
reader = csv.reader(file)
# skip first header row
next(reader)
I tried using the csv library but received an error. I did change the email address for this post.