I have the following code inside my CSOM console application to send email:
static private void sendemail(ClientContext context, string subject, string body, string email)
{
var emailp = new EmailProperties();
emailp.Subject = subject;
emailp.Body = body;
List<string> toUsers = new List<string>();
toUsers.Add(email);
emailp.To = toUsers;
Utility.SendEmail(context, emailp);
context.ExecuteQuery();
}
Now the email will be sent correctly incase the to email is defined inside office 365, otherwise no email will be sent.
Any idea why?