I have a server-side event receiver inside our SharePoint 2013 farm, and inside the ER i am sending emails using this code:-
using (MailMessage myMailMessage = new MailMessage())
{
SPOutboundMailServiceInstance smtpServer = mailserverinstance;
System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient(smtpServer.Server.Address);
myMailMessage.IsBodyHtml = true;
myMailMessage.Subject = title;
myMailMessage.Body = emailbody;
myMailMessage.From = new MailAddress(fromField);
string[] emailaddresses = to.Split(';');
foreach (var toemail in emailaddresses)
{
if (!string.IsNullOrEmpty(toemail))
{
myMailMessage.To.Add(new MailAddress(toemail));
}
}
if (!string.IsNullOrEmpty(cc))
myMailMessage.CC.Add(new MailAddress(cc));
if (myMailMessage.To.Count > 0)
{
smtp.Send(myMailMessage);
}
}
now i want to re-code my server-side event receiver, to work inside our SharePoint online tenant, so i am not sure how i will be sending emails inside my remote event receiver using CSOM? any sample codes?