Problem sending an automatic mail with NAS

AlishaAlisha Member Posts: 217
Hello,

I have written a report that loads data from a file to a table, and then sends a pdf to an address (using Outlook). It works fine when I run it, but when I try to run it automatically using NAS, I get an error like "Could not create an instance of the NS Outlook Syncronization Handler..."

How can I solve this?

Thanks!

Comments

  • WaldoWaldo Member Posts: 3,412
    Have you registered all necessary DLLs on the NAS Server? Like OLHandler.dll, ... . Does the server have an account on the Exchange server to send mails? ...

    I use SMTP-ocx (many info on this forum) for this... .

    Eric Wauters
    MVP - Microsoft Dynamics NAV
    My blog
  • AlishaAlisha Member Posts: 217
    I tried to use SMTP-ocx, but the account I have need username and password, and I haven't found information about how to put an username and password with this ocx, is it possible? It would be much easier than Outlook...
  • SaalekSaalek Member Posts: 181
    Hi

    When you run manualy, the mail is sended automaticaly, or a new message window is opened with the pdf as attachment??

    If a window is opened, there is the problem.

    Bye
  • AlishaAlisha Member Posts: 217
    If the outlook is open, no window pops up, but it doesn't work trough nas either. Another problem is that the email is not sent.. it remains in "Drafts".. but that's another problem..

    I would really rather to use an OCX to send the email without having to use Outlook, but the only ocx I have found doesn't allow autentification, as I said above.
  • SaalekSaalek Member Posts: 181
    Hi

    The problem is, you can't use anything with NAS that opens any kind of Window (Dataport, Dialog,...).

    Have you tried to change codeunit 397 newmessage function using MAPI (like 3.60, 3.70 versions) ??. Put OpenDialog property to FALSE

    Bye
  • KTAKTA Member Posts: 11
    Hello,

    I have already do that, using the "standard" code of Navision and a NAS (i put "standard" between quote, 'cause we change the code a little as ever...)

    The only one problem was to post automatically the email : we only must to let a OUTLOOK opened window under a session of an administrator user.

    Maybe it can help you, I hope so :)
  • AlishaAlisha Member Posts: 217
    Thanks for your help.. but I haven't been able to solve the problem. I have used the dll directly on my report, without making a call to the codeunit "Mail", but I obtain the same error. I have copied and registered the OLHandler.dll into the NAS folder, but still nothing..

    I any of you has more ideas...
  • SaalekSaalek Member Posts: 181
    Hi
    Try to use MAPI in your process.

    Name DataType Subtype
    MAPIHandler Automation 'Navision Attain ApplicationHandler'.MAPIHandler
    IF ISCLEAR(MAPIHandler) THEN
      CREATE(MAPIHandler);
    
    ErrorNo := 0;
    MAPIHandler.ToName := ToName;
    MAPIHandler.CCName := CCName;
    MAPIHandler.Subject := Subject;
    IF Body <> '' THEN
      MAPIHandler.Body := Body;
    MAPIHandler.AttachFileName := AttachFileName;
    MAPIHandler.OpenDialog := [b]FALSE[/b];
    
    MailSent := MAPIHandler.Send;
    ErrorNo := MAPIHandler.ErrorStatus;
    

    Bye
  • AlishaAlisha Member Posts: 217
    That seems to work fine, but now 2 windows appear asking if I want to allow a program to send a mail trough Outlook, (that it may be a virus), and another one saying that someone tries to access the email addresses stored on Outlook. Can you prevent this popups from opening?

    Thanks again, all of you are being really helpful...
  • jm1jm1 Member Posts: 13
    Hi,

    I have face this problem also before...

    Just for sugestion; why don't you try downloading the "Express ClickYes" installation package from http://www.ContextMagic.com

    It is tiny program that runs in the system tray and automatically clicks the Yes button.

    Best Regards
    Joel
  • jm1jm1 Member Posts: 13
    Alisha wrote:
    That seems to work fine, but now 2 windows appear asking if I want to allow a program to send a mail trough Outlook, (that it may be a virus), and another one saying that someone tries to access the email addresses stored on Outlook. Can you prevent this popups from opening?

    Thanks again, all of you are being really helpful...

    I forgot to mentioned that is not a virus but it is a Outlook security prompt, that asks you to confirm mail sending from third party applications or access to Outlook's address book.

    Best Regards
    jm1
  • Dmitry_ChadaevDmitry_Chadaev Member Posts: 52
    Hi,

    OLHandler (and concequently Codeunit 397 Mail) should work fine under NAS in Navision 4.0 SP1 ("Could not create an instance of the NS Outlook Syncronization Handler..." problem should be solved there). OLHandler does not produce any security warnings while sending e-mails - try to use it.
    Best regards,
    Dmitry
  • SaalekSaalek Member Posts: 181
    Hi
    If you change your default Mail client from Outlook to Oitlook express the message must disapear

    Bye
Sign In or Register to comment.