Posts

Showing posts from 2012

Send e-mail from SharePoint Object Model (SMTP)

Send e-mail from SharePoint Object Model (SMTP) From Visual Studio add reference to System.Net.Mail.... Use following code to send e-mail.                                 MailMessage mMailMessage = new MailMessage();                 mMailMessage.From = new MailAddress(fromeMailAddress,"Mail From Title");                 mMailMessage.To.Add(new MailAddress(to));                 if ((bcc != null) && (bcc != string.Empty))                 {                     mMailMessage.Bcc.Add(new MailAddress(bcc));                 }                 if ((replyTo != null) && (replyTo != string.Empty))                 {                     mMailMessage.ReplyTo = new MailAddress(replyTo);                 }                 if ((cc != null) && (cc != string.Empty))                 {                     mMailMessage.CC.Add(new MailAddress(cc));                 }                 mMailMessage.Subject = subject;