Running SMTP component from NAV 5.0 in older versions

nunomaianunomaia Member Posts: 1,153
edited 2013-10-10 in NAV Tips & Tricks
This procedure explains how to run SMTP component from NAV 5.0 in older versions. This was tested in Navision 4.0 SP3. Not all countries had NAV 5.0 a localized release.

If you don’t want this manual procedure of registering components you could also install NAV 5.0 client in same computer you are running NAV 4.0 SP3.

Manual Procedure:

1 – Copy “Microsoft.Navision.Mail.dll” and “Microsoft.Navision.Mail.tlb” from NAV 5.0 installation CD to NAV 4.0 client folder.

2 – You need to run regasmexe. This tool is located in “C:\Program Files\Tools;C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727”. When you run this tool you could add it to windows path or insert full path when running.

3 – In Navision client folder execute regasm Microsoft.Navision.Mail.dll /tlb:Microsoft.Navision.Mail.tlb

4 – Export fowling objects from NAV 5.0 to NAV 4.0

Form – 409 SMTP Mail Setup
Codeunit – 400 - SMTP Mail
Table – 409 - SMTP Mail Setup

Now you can use codeunit SMTP Mail to send e-mails instead of using 3rd party components or writing new one in .NET.




Copy from my Blog: http://dynamicsuser.net/blogs/nunomaia/archive/2007/09/10/running-smtp-component-from-nav-5-0.aspx
Nuno Maia

Freelance Dynamics AX
Blog : http://axnmaia.wordpress.com/

Comments

  • raieesraiees Member Posts: 33
    Hi Nano,
    I tried to register the dll as per your instruction but it gives error
    RegAsm Error: Failed to load Microsoft.Navision.Mail.dll becuase it is not a valid .NET assembly
  • ara3nara3n Member Posts: 9,255
    Make sure you have .NET 2 installed.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • mrtmrt Member Posts: 2
    Hi,

    SMTP componet registered successfully. Sending messages works just fine when running customized CU manually from Object Designer.
    But when trying to run same CU with NAS, CREATE(Mail) gives following error:

    Could not create an instance of the OLE control or Automation server identified by
    GUID={68AEAA7B-9523-3511-AF5F-F2381D2C6F04} 1.0:{F9DAE2A4-D2F8-37C3-86D5-E4FFE166D860}:'Microsoft Navision Mail'.SmtpMessage.


    We are using NAV 4.0 S3 (25143) and SQL 2005.

    Any ideas how to resolve this problem?
    Thanks in advance.
  • ara3nara3n Member Posts: 9,255
    Is the mail com object installed on the nas box as well? Is it the same box?
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • mrtmrt Member Posts: 2
    Yes, both client and NAS are installed in the same box.

    Fortunately at last I figured out how to get it work. I registrered dll from client directory and NAS is installed in different directory. Just copying dll and tlb files from client directory to NAS directory will solve this problem. It's unclear to me why NAS needs these files in his directory but it helps:)
  • ara3nara3n Member Posts: 9,255
    That's great, it will help other people who will run into this problem.
    Thanks for sharing.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • SivaMohanYerramsettySivaMohanYerramsetty Member Posts: 26
    Hi everyone,
    I have copied “Microsoft.Navision.Mail.dll and Microsoft.Navision.Mail.tld” in client folder (4.0 SP3), at the same time I have imported objects from 5.0 which are required for SMTP technology. But when I am sending the mail system giving this error.

    Could not create an instance of the OLE control or Automation server identified by
    GUID={68AEAA7B-9523-3511-AF5F-F2381D2C6F04} 1.0:{F9DAE2A4-D2F8-37C3-86D5-E4FFE166D860}:'Microsoft Navision Mail'.SmtpMessage
    check the OLE Control or Automation Server Correctly installed and registered.

    plz can anyone give solution for this.

    Thanks
    Shiv
  • ara3nara3n Member Posts: 9,255
    how did you register the dll?
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • garakgarak Member Posts: 3,263
    To use a dll or ocx as automation, u must register this dll / ocx under windows (windows basics). Do you did this :?:

    For example you will use your "Microsoft.Navision.Mail.dll" us must copy this file FROM a PC where it has been installed to the PC where it is missing.

    Then you open the CMD and use the regsvr32.exe to register your dll in the windows registry.
    regsvr32 "YourPathToYourDll\Microsoft.Navision.Mail.dll"
    

    When registration is successful, a message popps up and you can use this dll as Automation variable under NAVision.

    To unregister use the parameter
    /u
    
    regsvr32 /u "YourPathToYourDll\Microsoft.Navision.Mail.dll"
    

    Regards
    Do you make it right, it works too!
  • ara3nara3n Member Posts: 9,255
    If it's a .NET DLL file you need to use regasm.exe instead.
    You can search for the exe in windows directory somewhere. from cmd prompt you type



    REGASM MyAssembly.dll /tlb:MyAssembly.tlb

    To uninstall.

    REGASM /u MyAssembly.dll /tlb:MyAssembly.tlb
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • SivaMohanYerramsettySivaMohanYerramsetty Member Posts: 26
    Hi,
    Thanks for giving examples. I have registered the both DLL’s successfully (by taking of your examples) but still I am getting the same error message. :(

    Thanks & Regards
    Shiv
  • ara3nara3n Member Posts: 9,255
    Try to install 5.0 exe and see if you can access the dll files
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • annarannar Member Posts: 24
    I have the component installed, restarted the PC but still I can only see 'Microsoft Navision Mail'.Unknown Class and it simply does not seem to recognize the component.

    Any ideas besides installing 5.0 on the machine?
  • paulfisherpaulfisher Member Posts: 3
    I had this problem and solved it by copying the .dll and .tlb file to the client directory (C:\Program Files\Microsoft Business Solutions-Navision\Client) and registering the files from there (as described above).
  • ara3nara3n Member Posts: 9,255
    when registering the dll add the following


    REGASM MyAssembly.dll /tlb:MyAssembly.tlb /codebase



    the codebase parameter solved a .NET DLL file i was trying to register.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • sanjeevasawalesanjeevasawale Member Posts: 63
    Thanks nunomaia it worked for me. =D>
  • MauddibMauddib Member Posts: 269
    ara3n wrote:
    That's great, it will help other people who will run into this problem.
    Thanks for sharing.

    I might have something else that will help people with this never ending DLL issue. It works but I do not know WHY it works. Or why it breaks in the first place.

    I am currently working on upgrading our 3.6(5) system to Nav2009 complete.

    As part of this I installed the Nav2009 client on 10 user PCs who were all going to test for me.

    On some PCs... but not all.... the Navision Mail DLL simply stopped functioning. Especially when trying to "Show" a navision stored email in Outlook.

    Not only were the problems random but the fixes were too. A fix on one PC did not work on another.

    Fixes that worked for me:

    1) Unregistering and re-registering the NSAPPhandler DLL.
    2) Unregistering and re-registering the Navision Mail DLL using Regasm and TLB etc. As another user stated its best to use the DLL in the Client directory and NOT the one that is in the "Common Files" directory. When I use the latter it often (but not always AGAIN) does not work.
    3) Rolling back to the 2007 file (version 5) of NSApphandler.

    and the weirdest one:

    4) Deleting entirely the Outlook profile for the user and setting it up again... or in fact deleting the entire profile for that user off the PC and letting the user log in again to get a new profile built.

    The last one is a mystery to me as to why it works!!! We only tried it because one user had the mail fail issue and nothing we tried worked. But we noticed that when we logged in with another user on that PC it was fine. And when that user logged in on another PC it was fine. It really was just this one user-machine combination failure.

    So we hit on the idea of just deleting her profile on that machine entirely and then letting her log in again. Problem was gone!!! It was not a ZUP file issue either as I had already tried deleting that.

    On Monday we will be installing Nav 2009 classic client on ALL PCs in our company as a prelude to upgrading the Database next weekend. Then they will all come in Monday morning and use the new client.

    I envision most of Monday being wasted battling the above Email problem on random PCs all over the company. ARGH! :-(
Sign In or Register to comment.