Thursday, September 24, 2009

SPUtility.SendEmail truncates your message body

Use this instead to send longer emails from SharePoint:



MailMessage message = new MailMessage();
message.From = new MailAddress(list.ParentWeb.Site.WebApplication.OutboundMailSenderAddress);
message.To.Add(new MailAddress("email@email.com));
message.Subject = "Subject";
message.Body = "Body";
SmtpClient smtpClient = new SmtpClient(SPContext.Current.Site.WebApplication.OutboundMailServiceInstance.Server.Address);
smtpClient.Send(message);