Send email with attachment - .net

I have seen many posts over forums asking for how to send emails in

In this blog post, I am going to post code snippet to send email in (with attachment).

Check out Below Code to send email with attachment in

public static bool SendMail(string strFrom, string strTo, string strSubject, string strMsg)
// Create the mail message
MailMessage objMailMsg = new MailMessage(strFrom, strTo);

objMailMsg.BodyEncoding = Encoding.UTF8;
objMailMsg.Subject = strSubject;
objMailMsg.Body = strMsg;
Attachment at = new Attachment(Server.MapPath("~/Uploaded/txt.doc"));
objMailMsg.Priority = MailPriority.High;
objMailMsg.IsBodyHtml = true;

//prepare to send mail via SMTP transport
SmtpClient objSMTPClient = new SmtpClient();
objSMTPClient.DeliveryMethod = SmtpDeliveryMethod.PickupDirectoryFromIis;
return true;
catch (Exception ex)
throw ex;

RECENT THIRTY POSTS (click on the link to read details)