Hi sduma677,
What I understand from your question is that you want to send exactly 8 files as attachments via email.
If this is your question, then you can simply add one more condition to check the count of selected file before attaching it to MailMessage object.
if (model.Attachments != null && model.Attachments.Count == 8)
{
foreach (IFormFile attachment in model.Attachments)
{
string fileName = Path.GetFileName(attachment.FileName);
mm.Attachments.Add(new Attachment(attachment.OpenReadStream(), fileName));
}
}
Hope, this is will help you.