Of course you can send email from your application with attachment(s).
Please find the below code snippet to achieve that.
using System.Net.Mail;
using (MailMessage mailMessage = new MailMessage())
{
mailMessage.From = new MailAddress("user@gmail.com");
mailMessage.Subject = txtSubject.Text.Trim();
mailMessage.Body = txtBody.Text.Trim();
mailMessage.IsBodyHtml = true;
mailMessage.To.Add(new MailAddress(txtTo.Text.Trim()));
mailMessage.Attachments.Add(new Attachment(file.InputStream, Path.GetFileName(file.FileName), file.ContentType));
SmtpClient smtp = new SmtpClient();
smtp.Host = "smtp.gmail.com";
smtp.EnableSsl = true;
System.Net.NetworkCredential NetworkCred = new System.Net.NetworkCredential();
NetworkCred.UserName = mailMessage.From.Address;
NetworkCred.Password = "<Password>";
smtp.UseDefaultCredentials = true;
smtp.Credentials = NetworkCred;
smtp.Port = 587;
smtp.Send(mailMessage);
}
if you want multiple attachments then call
mailMessage.Attachments.Add(new Attachment(file.InputStream, Path.GetFileName(file.FileName), file.ContentType));
this inside for loop or foreach loop.
If it answers your query then don't forget to mark it as answer so that others can benefit from it also.
Pradeep(PKM)