smtp.office365.com in SMTP Mail Setup | NAV 2016

navuser1navuser1 Member Posts: 1,329
Dear Sir,

The following error message is occurred when I click "Test Email Setup" in the SMTP Mail Setup Page.

Microsoft Dynamics NAV

The SMTP mail system returned the following error: "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. 0.35250:CF050000, 1.36674:0A000000, 1.61250:00000000, 1.45378:02000000, 1.44866:87200000, 1.36674:0E000000, 1.61250:00000000, 1.45378:8C200000, 1.44866:6C010000, 16.55847:BC0F0000, 17.43559:0000000004020000000000000000000000000000, 20.52176:140F938A1E00000000000000, 20.50032:140F938A8E1770200A002C84, 0.35180:140F938A, 255.23226:ED050000, 255.27962:0A000000, 255.27962:0E000000, 255.31418:F2050000, 0.35250:0A000000, 1.36674:0A000000, 1.61250:00000000, 1.45378:02000000, 1.44866:70000000, 1.36674:32000000, 1.61250:00000000, 1.45378:75000000, 1.44866:01000000, 16.55847:DC000000, 17.43559:0000000000030000000000000100000000000000, 20.52176:140F938A1E0010100B060000, 20.50032:140F938A8E17000003000136, 0.35180:10060000, 255.23226:0A005389, 255.27962:0A000000, 255.27962:32000000, 255.17082:DC040000, 0.27745:4800D13D, 4.21921:DC040000, 255.27962...".
OK

But we can sent email using the same smtp setup thru custom code.

So, what is the reason of that issue ?

Kinly reply.

navuser1
Now or Never

Answers

  • edoderooedoderoo Member Posts: 89
    It might be an issue with the setup of the mailbox. I read somewhere SendAsDenied, and the return-address / sender is probably different then the owner of the mailbox. You can try changing the sender of the mail, or change the setup of the mailbox to allow Send-as-different-mailuser.
    IF User.Loves('Edo') THEN ok() ELSE currReport.genSkip;
  • navuser1navuser1 Member Posts: 1,329
    The smtp setup has office 365 server settings. The Test Mail Email Setup does not work properly. It gives an error message as below..
    augoq7tiik0a.png

    But I can able to send email thru C/AL Code without any issue. The same smtp setup is used in the programming language. Then where is the actual issue ?
    Now or Never
  • edoderooedoderoo Member Posts: 89
    Sometimes you get other/better details in the Windows logs of one of the servers. The application server, the NAV-server, the SQL-server or the machine where the user is sending mails from. I'm afraid that your situation is pretty technical and caused by the mail-setup and the way the mail is sent. If you have a system administrator, I would ask him for advice.
    IF User.Loves('Edo') THEN ok() ELSE currReport.genSkip;
  • navuser1navuser1 Member Posts: 1,329
    Thanks for your reply.

    Yesterday, I have debugged to understand the internal matter of that issue. The Codeunit 412 SMTP Test Mail has a function called "SendTestMail", its code as under.
    SMTPMailSetup.GET;   //Table 409
    
    SMTPMail.CreateMessage(                                //Codeunit 400
      '',
      EmailAddress,   //first
      EmailAddress,
      TestMailTitleTxt,
      STRSUBSTNO(
        TestMailBodyTxt,
        USERID,
        SMTPMailSetup."SMTP Server",
        FORMAT(SMTPMailSetup."SMTP Server Port"),
        SMTPMailSetup.Authentication,
        SMTPMailSetup."Secure Connection",
        SERVICEINSTANCEID,
        TENANTID),
      TRUE);
    
    SMTPMail.Send;
    MESSAGE(TestMailSuccessMsg,EmailAddress);
    

    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.
    Now or Never
  • edoderooedoderoo Member Posts: 89
    The first EmailAddress (second parameter) is the SenderAddress. Your mailserver is using this to check if you are allowed to send mail.

    If you need this mailaddress to be something specific that your current mailserver does not allow you to use, you can work around this by setting up a simple SMTP-server in your network that will forward the mail for you. Else you can ask your administrator to make the restrictions less strict.

    In the end this is more an issue on your mailserver then in NAV.
    IF User.Loves('Edo') THEN ok() ELSE currReport.genSkip;
  • navuser1navuser1 Member Posts: 1,329
    System Admin says there is no similar kind of restrictions in the mail server. There anybody@clientdomain.com can send emails to anybody@anydomain.com.

    The problem occurs when second parameter & third parameter are same and second parameter <>SMTPMailSetup."User ID".
    Now or Never
  • Ivan_LabradorIvan_Labrador Member Posts: 4
    Hello, I am having the exact same problem, the solution is in the mail settings? or from Navision?
  • RockWithNAVRockWithNAV Member Posts: 1,139
    Is Setup all correct?
    Did you tried debugging and see which line of code is the Issue?
  • DamjanDamjan Member Posts: 94
    Hi,
    I have the same issues on NAV2013 R2, we have changed mailbox top Office365 and emails cannot be sent.

    Office365 user has account type: "Exchange online-kiosk". I'm not sure if this is related to that issue.

    Error is this
    ---
    Microsoft Dynamics NAV

    Break On Error Message:

    The SMTP mail system returned the following error: "Transaction failed. The server response was: 5.2.252 STOREDRV.Submission.Exception:SendAsDeniedException.MapiExceptionSendAsDenied; Failed to process message due to a permanent exception with message Cannot submit message. 0.35250:29150000, 1.36674:01000000, 1.61250:00000000, 1.45378:02000000, 1.44866:00000000, 1.36674:7A000000, 1.61250:00000000, 1.45378:05000000, 1.44866:00140000, 1.36674:0A000000, 1.61250:00000000, 1.45378:16000000, 1.44866:87260000, 1.36674:0E000000, 1.61250:00000000, 1.45378:A0260000, 1.44866:30020000, 16.55847:96120000, 17.43559:0000000030020000000000000000000000000000, 20.52176:140F54910800F01F0A001612, 20.50032:140F54917817F01F07000000, 0.35180:1F000130, 255.23226:0A000000, 255.27962:7A000000, 255.27962:0A000000, 255.27962:0E000000, 255.31418:21000000, 0.35250:1F001336, 1.36674:0A000000, 1.61250:00000000, 1.45378:02000000, 1.44866:5A000000, 1.36674:32000000, 1.61250:00000000, 1.45378:5F000000, 1.44866:01000000, 16.55847:C6000000, 17.43559:0000000088030000000000000100000000000000, 20.52176:140F54910800101068000000, 20.50032:140...".
    OK
    ---

    Code breaks on CU408.TrySend function
Sign In or Register to comment.