Personalized Community is here!
Quickly customize your community to find the content you seek.
Choose your path Increase your proficiency with the Dynamics 365 applications that you already use and learn more about the apps that interest you. Up your game with a learning path tailored to today's Dynamics 365 masterminds and designed to prepare you for industry-recognized Microsoft certifications.
Visit Microsoft Learn
2020 Release Wave 2Discover the latest updates and new features to Dynamics 365 planned through March 2021.
Release overview guides and videos Release Plan | Preview 2020 Release Wave 2 TimelineWatch the 2020 Release Wave 1 virtual launch event
Ace your Dynamics 365 deployment with packaged services delivered by expert consultants. | Explore service offerings
Connect with the ISV success team on the latest roadmap, developer tool for AppSource certification, and ISV community engagements | ISV self-service portal
The FastTrack program is designed to help you accelerate your Dynamics 365 deployment with confidence.
FastTrack Program | Finance TechTalks | Customer Engagement TechTalks | Upcoming TechTalks
My client has configured the SMTP Mail Setup on smtp.office365.com. And the Test mail functionality is giving the below error message...
But we could sent sms thru custom code. My JOB Queue notification is not working due to the issue.
I have debugged to understand the issue, I found that the Codeunit 412 SMTP Test Mail has a function called "SendTestMail", its code as under.
SMTPMailSetup.GET; //Table 409
SMTPMail.CreateMessage( //Codeunit 400
FORMAT(SMTPMailSetup."SMTP Server Port"),
The above code is working fine when the smtp setup is rather than smtp.office365.com. But it is very strange to see if I replace the first "EmailAddress" by SMTPMailSetup."User ID" then it's working fine. but still JOB Queue notification is not working.
Kindly reply to solve this matter.
The one you replaced is the sender email address, In your version do you codeunit 9520? if so replace above with the following where MailManagement is 9520
FORMAT(SMTPMailSetup."SMTP Server Port"),
Thanks for your reply...
I have some doubt about the undocument feature of this matter. BTW, Kindly inform me the version where MS had rectified the same.
My Version is NAV 2016 CU 48 (Object version -Object Codeunit 9520 Version NAVW19.00.00.45778)
Your error is "SendAsDeniedException". This is an Office365 related issue and not a NAV/Business central related issue.
In Office365 you are only allowed to state the sending address as the one setup on the login account. It is a security mechanism and is not a limitation of NAV/Business Central.
This is to make sure nobody misuses the Office365 account to send e-mail from another e-mail (i.e. Joe Jobbing or similar - see https://en.wikipedia.org/wiki/Joe_job).
You can - however - add/whitelist other sending addresses in the same email domain by granting the login account "send as" or "send on behalf of" (can't remember which one right now). But that requires you to know and having a limited set of sending addresses before hand. Please see https://docs.microsoft.com/en-us/office365/admin/add-users/give-mailbox-permissions-to-another-user?view=o365-worldwide about how to grant those permissions in Office365.
Note - as an alternative you can use another SMTP service to send e-mails. If you have Azure services anyway, you can add a SendGrid account with 25,000 free e-mails/month: see https://docs.microsoft.com/en-us/azure/sendgrid-dotnet-how-to-send-email (ignore the part about how to send e-mails from DotNet).
We can sent email thru Coding but smtp test mail is not working.
On the other hand, smtp test mail working fine if smtp server is rather than office365.
Still - if the error is SendAsDeniedException it is because you are sending from a e-mail address that is not whitelisted in Office365. Can't remember if you are allowed to select that on a test e-mail or it just picks the one from company info..
when trying to send an email to email@example.com from Test Mail (thru SMTP Mail Setup) the error comes as SendAsDeniedException but I can send email to firstname.lastname@example.org thru below code....
SMTPMail.CreateMessage("From Name",SMTPSetup."User ID","Send to",Subject......
Please re-read my answers and note that I'm taking about FROM e-mail address - not the TO e-mail address
This error has nothing to do with who you are sending TO, it is only related to who you are sending FROM.
In your working example you are sending FROM SMTPSetup."User ID". And it is not really a surprise that an Office365 user can send from his own e-mail address.
In the non-working example you are sending FROM another e-mail address. Probably either the one setup on the NAV/BC login account or the company e-mail. It depends on your version of NAV/BC.
That exact address needs to be whitelisted in Office365 for this to work.
Business Applications communities