It has been a long time since I have written a component that sends email. In the .NET world, sending email has been made very easy and all the objects are defind under the System.Web.Mail namespace. System.Web.Mail is a simple wrapper for the COM objects in cdonts.dll and cdosys.dll.
Following is a code snipped for sending email with an attachment:
MailMessage MailMsg= new MailMessage(); MailMsg.To = "sunitc@microsoft.com"; MailMsg.From = "SWM_Test@sunitc.com"; MailMsg.Subject = "[info] System.Wed.Mail Test Message"; MailMsg.Body = "System.Web.Mail Body of the Message"; // Create the attachment : enter the correct path to the file that is to be attached MailAttachment attachment = new MailAttachment("mypath\test.txt"); //create the attachment MailMsg.Attachments.Add( attachment ); // Put in your real smtp server below SmtpMail.SmtpServer = "mySmtpServer"; SmtpMail.Send( MailMsg);