I am trying to send a email including an attachment. This attachment should be attached automatically using the code behind at the time of opening the mail draft. Could anyone suggest the correct solution.
code I have used:
MailMessage mailMessage = new MailMessage();
string ExFilePath = HttpContext.Current.Server.MapPath("~/Files/Assets.xlsx");
Attachment data = new Attachment(ExFilePath,MediaTypeNames.Application.Octet);
mailMessage.Attachments.Add(data);`
I need to attach the file automatically in mail body.