Question

I am using following code to send email in SharePoint from C# CSOM.

EmailProperties emailProperties = new EmailProperties();
emailProperties.To = toAddress;
emailProperties.From = fromAddress;
emailProperties.Body = body;
emailProperties.Subject = subject;
Utility.SendEmail(clientContext, emailProperties);
clientContext.ExecuteQuery();

Its working fine. But when I try to send email on external domain like gmail.com it gives error.

The e-mail message cannot be sent. Make sure the e-mail has a valid recipient

I am understanding the problem but I need to know can I send email using Utility.SendEMail to an other domain email address?

I am using SharePoint 2013 (CSOM C#)

I have gone through this. But I can't apply this settings.

Était-ce utile?

La solution

After referring to multiple blogs, it seems sending mail from SP 2013 to external users is not possible unless you add then to AD.

If you are unwilling to add users to AD then workaround is available :

  1. Create 2010 workflow to start manually, add step to send mail. (SP 2010 allows to send mail to external user).
  2. Through CSOM start the workflow with parameter (can be mail address). Refer this blog for details : http://www.vrdmn.com/2014/08/start-sharepoint-2013-workflows-with.html
Licencié sous: CC-BY-SA avec attribution
Non affilié à sharepoint.stackexchange
scroll top