ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010_SP1);
service.UseDefaultCredentials = false;
service.Credentials = new WebCredentials("EmailSender", "Password");
string serviceUrl = "https://outlook.office365.com/ews/exchange.asmx";
service.Url = new Uri(serviceUrl);
EmailMessage emailMsg = new EmailMessage(service);
emailMsg.From = currentUser.Email; //This email is different from Credential email
emailMsg.Subject = mailSubject;
emailMsg.Body = mailBody;
The user account which was used to submit this request does not have the right to send mail on behalf of the specified sending account., Cannot submit message.
The Credential user has 'Send As' access. maybe need on behalf access or something like that!?
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)