Azure Add-in Send Email SharePoint Online Office 365

InfoPath alternatives for form designing SharePoint

It’s very common requirement to send email through custom code when we design and develop any application. In general for custom webpart in SP 2013 we can use internal organization SMTP address to send email notification through code.

Also you can read:
– Configure On Premise environment for Apps in SharePoint 2016

– SharePoint 2016 List View Auto Indexing Automatic Index Management

– How to send email from SharePoint Online using Rest API?

In Azure hosted solution in SharePoint Online, we have to follow below approach to send Email. We will need a cloud only account created in Office 365 Online Exchange without Multifactor authentication enabled.

The account will be used in Azure app to send email to connect directly to Office 365 using the SMTP client submission endpoint “smtp.office365.com” and establish the connection.

We will have to use the Cloud Only account and password provided in code to connect “smtp.office365.com”

Below code snippet for further reference.
SmtpClient clt = new SmtpClient();
clt.UseDefaultCredentials = false;
clt.Credentials = new System.Net.NetworkCredential(“O365 cloud only user account”, “Password”);
clt.Port = 587;
clt.Host = “smtp.office365.com”;
clt.DeliveryMethod = SmtpDeliveryMethod.Network;
clt.EnableSsl = true;

Hope this will be helpful.

Similar SharePoint 2013 Tutorials


About Sambita Rath

I have 9 years of exprience into SharePoint implementation, architecture, Administrator, development and Training.Designing Information Architecture in SharePoint 2007, 2010,2013 and Office 365.

View all posts by Sambita Rath →

Leave a Reply