The email message cannot be sent .make sure the email has a valid recipient

Ever tried to send emails using CSOM using

and got an exception “The email message cannot be sent .make sure the email has a valid recipient“.

The reason is the ClientContext, you are passing to the function. Make sure the sharepoint site with which you created the Client Context has the Mail Recipient listed in the All People Group. To check that,

Navigate to [Site_Url]/_layouts/15/people.aspx?MembershipGroupId=0

and make sure the Email To user is listed in the group.

For more info Refer this .

ews-Id is malformed

Ever tried to get tasks or emails from exchange using ews and faced this weird exception id is malformed. In my case, i had a http get to my ews method which accepted the id as a query string and id contains some special characters like +, / , = .  and all the + characters were replaced by spaces during the http get call. a example id will look like this.

So, it’s very important that you replace the + with %2B while making the get call.

so , whenever you get this error chances are some of the special characters in the id are missing. Taking care of that should solve this exception.

Happy coding…