Transaction failed. The server response was: 5.2.0 STOREDRV.Submission.Exception:SendAsDeniedException.MapiExceptionSendAsDenied;

Viewed 20441

Can someone help me out to this below issue. We done change smtp to office365 but after change the smtp host, we start getting below issue

Transaction failed. The server response was: 5.2.0 STOREDRV.Submission.Exception:SendAsDeniedException.MapiExceptionSendAsDenied; Failed to process message due to a permanent exception with message Cannot submit message.

2 Answers

The email address used in the SMTP protocol (MAIL From:<salesperson1@contoso.com>) must be identical to your office365 account name, i.e. "salesperson1@contoso.com".

Source: check this Microsoft support page, related to printers and scanners:

"Your printer or application must send email from the same address that you entered logon credentials for during email setup. If the printer or application tries to send email from a different account, this results in an error similar to:

5.7.60 SMTP; Client does not have permissions to send as this sender.

For example, if you entered login credentials for sales@contoso.com in your application settings, but the application tries to send emails from salesperson1@contoso.com, this is not supported. For this scenario, use Microsoft 365 or Office 365 SMTP relay instead."

In our case, the address mismatch causes office365.com to reply with the following error message:

554 5.2.0 STOREDRV.Submission.Exception:SendAsDeniedException.MapiExceptionSendAsDenied; Failed to process message due to a permanent exception with message Cannot submit message.

and has been resolved as described.

If using Asp.net/c#, then ensure the sender id used in NetworkCredential is similar to the from email address as below:

MailServer.Credentials = new System.Net.NetworkCredential(SenderId, SenderPass);
MailAddress from = new MailAddress(SenderId);
Related