mail import in navision 4.0

rwabelrwabel Member Posts: 32
I'm wondering if the possibility exist to receive mails in Navision 4.0. I found a lot of discussions about sending mails, but is it also possible to receive an email? The purpose would be to receive an email with an xml attachement which then could be imported in navision (thanks to the xml ports).
But maybe this is impossible to do.

thanks

Comments

  • kinekine Member Posts: 12,562
    You can read emails from outlook or use for example JMail library for POP3...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • jhoekjhoek Member Posts: 216
    The Microsoft MAPI controls (shipped with earlier versions of Navision) can read e-mails from your Inbox. I use them for the same purpose (i.e. detaching attachments which are imported into Navision).
    Kind regards,

    Jan Hoek
    Product Developer
    Mprise Products B.V.
  • Luc_VanDyckLuc_VanDyck Member, Moderator, Administrator Posts: 3,633
    Here is some code to get you started:

    Variables:
    ----------
    autOLAppl	     Automation	'Microsoft Outlook 11.0 Object Library'.Application	
    autOLNamespace   Automation	'Microsoft Outlook 11.0 Object Library'.NameSpace	
    autOLItems	    Automation	'Microsoft Outlook 11.0 Object Library'.Items	
    autOLMapiFolder  Automation	'Microsoft Outlook 11.0 Object Library'.MAPIFolder	
    autOLMItem	    Automation	'Microsoft Outlook 11.0 Object Library'.MailItem	
    txtFindCriteria  Text		250
    intEndOfLoop     Integer		
    i                Integer		
    
    
    Code:
    -----
    CLEAR(autOLAppl);
    CREATE(autOLAppl);
    autOLNamespace := autOLAppl.GetNamespace('MAPI');
    autOLNamespace.Logon('','',TRUE,FALSE);
    
    autOLMapiFolder := autOLNamespace.GetDefaultFolder(6);
    autOLItems := autOLMapiFolder.Items;
    txtFindCriteria := '[Sendername] = ''webmaster mibuso.com''';
    autOLItems := autOLMapiFolder.Items.Restrict(txtFindCriteria);
    
    i := 1;
    intEndOfLoop := autOLItems.Count;
    WHILE i <= intEndOfLoop DO BEGIN
      autOLMItem := autOLItems.Item(i);
      IF CONFIRM(autOLMItem.Subject) THEN;
      i := i + 1;
    END;
    
    CLEAR(autOLMItem);
    CLEAR(autOLAppl);
    
    This code reads your (Outlook) inbox, and display the subjects of messages send by ... me.
    No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)
  • jhoekjhoek Member Posts: 216
    Looks good, Luc, but in general I prefer to use the MAPI controls, as they will work with any mail client - not just Outlook or Outlook Express.
    Kind regards,

    Jan Hoek
    Product Developer
    Mprise Products B.V.
  • rwabelrwabel Member Posts: 32
    thanks a lot for the answers guys.

    it would be best to not be dependend from a mail client especially not a specific like outlook.

    Best solution would be to "pop" the mail directly from the server without any clients.
    @kine: can I with JMail library for POP3 get the mails directly from the server?

    @jhoek: I suppose that with MAPI I'm dependend from a mailclient. Or am I wrong?

    @luc van dyck: thanks for the code, but it should be client independent. Best would be even handle it directly without going via a mail client.

    thanks
  • jhoekjhoek Member Posts: 216
    I suppose so, yes. Not sure though.
    Kind regards,

    Jan Hoek
    Product Developer
    Mprise Products B.V.
  • kinekine Member Posts: 12,562
    I think yes, it is implementation of the POP3 protocol - you get mail directly from server...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • vrushankvrushank Member Posts: 16
    Thanks everyone, this was exactly what i was looking for~~~~~
    A day without the sun is like night
Sign In or Register to comment.