Click here to Skip to main content
15,884,237 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i must send mails from my sharepoint application to lot of reciepients.

but i can not send mail to everyone who is not member of my sharepoint.

help me
Posted

1 solution

Your question isn't complete as you have not specified what type of SharePoint Application you are building.

In SharePoint 2013, you have several flavours of application development such as Full Trust Solution, SharePoint App etc.

Anyway, let's assume you have a Full Trust Solution. The default SPUtility SendMail functionality in SharePoint is limited. And you can only send emails to people who are known within the site collection. If you only want to send email to people within site collection, then make sure you use EnsureUser() to check the availibility in site collection.

Something like this:

C#
private void SendEmail(ClientContext clientContext)
{
	User sendToUser = clientContext.Web.EnsureUser("abc@def.com");
	clientContext.Load(sendToUser);
	clientContext.ExecuteQuery();

	string email = Microsoft.SharePoint.Client.Utilities.Utility.GetCurrentUserEmailAddresses(clientContext).Value;

	Microsoft.SharePoint.Client.Utilities.EmailProperties properties = new Microsoft.SharePoint.Client.Utilities.EmailProperties();
	properties.To = new string[] { sendToUser.Email };
	properties.Subject = "subject";
	properties.Body = "body";

	Microsoft.SharePoint.Client.Utilities.Utility.SendEmail(clientContext, properties);

	clientContext.ExecuteQuery();
}

Here is an article which can give you a head start (and code) on how to do this. (Full Disclaimer: This refers to my own post on my blog).

http://manasbhardwaj.net/how-to-send-email-using-sharepoint/
 
Share this answer
 
v2
Comments
Maciej Los 4-Nov-14 17:56pm    
Self-reference - i like it ;)
Manas Bhardwaj 4-Nov-14 18:05pm    
:)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900