Office365 SMTP Error: 554 5.2.0 STOREDRV.Submission.Exception:SendAsDeniedException.MapiExceptionSendAsDenied;
Question:
I’m trying to send email using SMTP via smtp.office365.com, and I get this error:
554 5.2.0 STOREDRV.Submission.Exception:SendAsDeniedException.MapiExceptionSendAsDenied; Failed to process message due to a permanent exception with message Cannot submit message. 0.35250:0A001485, 1.36674:0A000000, 1.61250:00000000, 1.45378:02000000, 1.44866:59020000, 1.36674:0E000000, 1.61250:00000000, 1.45378:5E020000, 1.44866:F8000000, 16.55847:BC030000, 17.43559:0000000024020000000000000000000000000000, 20.52176:140FFA8B1500001000000000, 20.50032:140FFA8B8517001000000000, 0.35180:F1030000, 255.23226:09000000, 255.27962:0A000000, 255.27962:0E000000, 255.31418:F1030000, 0.35250:0300C981, 1.36674:0A000000, 1.61250:00000000, 1.45378:02000000, 1.44866:3A000000, 1.36674:32000000, 1.61250:00000000, 1.45378:3F000000, 1.44866:01000000, 16.55847:A6000000, 17.43559:0000000070030000000000000000000000000000, 20.52176:140FFA8B1500101040180000, 20.50032:140FFA8B8517101000000000, 0.35180:45180000, 255.23226:2D020000, 255.27962:0A000000, 255.27962:32000000, 255.17082:DC040000, 0.27745:62180000, 4.21921:DC040000, 255.27962:FA000000, 255.1494:00000000, 0.38698:00000000, 0.37692:01000000, 0.37948:FB81DB3C, 5.33852:00000000534D545000000100, 7.36354:0100000000000109302E3330, 4.56248:DC040000, 7.40748:010000000000010B3A373361, 7.57132:00000000000000006639332D, 1.63016:32000000, 4.39640:DC040000, 8.45434:0140030070B551B6000000000000000005000780, 5.10786:0000000031352E32302E333036362E3032313A444D36505232304D42323334383A37336136646161652D336435332D346639332D393535302D34396164643762356436613100E06500000000, 7.51330:7E9ED170D80CD8081A010480, 0.39570:00000000, 1.55954:0A000000, 0.49266:56000000, 1.33010:0A000000, 2.54258:00000000, 0.40002:02000000, 1.56562:00000000, 1.64146:32000000, 1.33010:32000000, 2.54258:DC040000, 255.1750:AF000000, 255.31418:0A005D36, 0.22753:A9000000, 255.21817:DC040000, 0.64418:0A00F565, 4.39842:DC040000, 0.41586:B9000000, 4.60547:DC040000, 0.21966:B3000000, 4.30158:DC040000 [Hostname=DM6PR20MB2348.namprd20.prod.outlook.com]
What is the cause?
Answer:
The Microsoft Office 365 SMTP server provided a wonderfully informative error message (sarcasm).
The clue in all of the above gibberish is the “SendAs” in “SendAsDeniedException”. It means you authenticated using one email address, but tried to send email using another email address for the “FROM” address. (i.e. you are “sending as” another person).
Your Office365 account may need to be setup to “Send email on behalf of another user”
See https://docs.microsoft.com/en-us/microsoft-365/admin/add-users/give-mailbox-permissions-to-another-user
This error occurs if the email address used for authentication is different than the FROM email address.
The solution is to update your Office365 account settings to allow for sending on behalf of the FROM email address.