SMTP Mail error

ben5000ben5000 Member Posts: 110
Hi experts :)

I get the following error when trying to send an email from Nav Classic Client (v5)

Microsoft Dynamics NAV
This message is for C/AL programmers:

Could not invoke the member Send. The OLE control or Automation server returned an unknown
error code.

OK

Here is the code I use (where SMTPMail is CU400 = "SMTP Mail") :
  SMTPMail.CreateMessage('John Doe', 'john.doe@contonso.com', 'pamela@microsoft.com', 'Mail title', 'This is the body of the mail', FALSE);
  SMTPMail.Send();
END;

The fact is that the same code works on the NAS but not on my client.
So I taught the Automation Server was not correctly registered.
But when using debugger shows that the error rises when calling the automation variable Mail.Send()
Moreover the Automation server is listed in the Automation Server table.

I've searched in the forum but found nothing.
I restarted my computer to refresh the registry.
I tried to declare a new Mail automation variable in CU 400.

Nothing solved my problem. So could you advise please? :)

Many thanks for your help!

Comments

  • Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
    Does your system have permissions to use the SMTP server? Maybe relaying is switched off.
  • ben5000ben5000 Member Posts: 110
    Hi Mark,

    SMTP service is running.
    There is nothing in the event viewer.
  • Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
    Troubleshooting SMTP can be a nightmare.

    It is most likely a permission thingy.

    Have you tried other SMTP tools? Can you send emails via SQL Mail? That uses SMPT too. You can also try the SMTP download here on Mibuso, which sometimes gives better error messages.

    AFAIK the Microsoft SMTP is based on .NET, the Mibuso SMTP is based on OCX.
  • SlamSlam Member Posts: 1
    Hi

    We have had this error before and it was definitely a permission issue. If relay has been activated on Exchange, it could have something to do with roaming IP's.
  • KYDutchieKYDutchie Member Posts: 345
    Hi,

    what is your client version?
    Microsoft has released a hotfix, KB2499881, for the SMTP "features" in NAV. However this hotfix is only for 2009SP1 and R2. The new set of dll's actually returns the correct error messages and will allow you to set the port and use SSL.
    I have to say that I've had good experiences with this hotfix. It actually makes SMTP work better.

    I hope this helps,

    Regards,

    Willy
    Fostering a homeless, abused child is the hardest yet most rewarding thing I have ever done.
  • ben5000ben5000 Member Posts: 110
    Thanks for all your replies :)

    I'll investigate the permission issue with the internal IT Admin next week.

    I'll keep you informed!
Sign In or Register to comment.