'Add attachment in draft e-mail

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.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source