We want to send out reminder emails via autheticated SMTP in small batches, fewer than one hundred (100) per batch. The content of each email is different, and each has only one recipient.
The process is running as a Windows Service that fetches the necessary info from the database every few minutes, and replaces placeholders in the email html with data from the database. There is no GUI to worry about blocking.
Should we loop through the data records as in this pseudocode, sending one email at a time?
instantiate smtpClient
authenticate smtpClient
for each datum in data
message = BuildEmailMessage(datum)
Task.Run(()=> smtpClient.Send(message))
next
smtpClient.Disconnect()