mibuso.com

Microsoft Business Solutions online community
It is currently Sat May 25, 2013 10:25 am

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: How to send mail using MAPISession & MAPIMessages?
PostPosted: Wed Aug 19, 2009 5:19 pm 
Offline
Site Admin
MVP Microsoft Dynamics NAV
NAV TechDays 2013 attendee

Joined: Sun Nov 07, 1999 8:01 am
Posts: 3294
Location: Wilrijk
Country: Belgium (be)
I need NAV to generate mails with more than one attachment, that's why I try to send mails using the MAPISession & MAPIMessages OCX.

When this code is executed, the error "The call to member Send failed. MAPIMessages returned the following message: Unspecified Failure has occurred" is displayed:

Code: Select all
variables used:
ocxMAPISession     OCX   Microsoft MAPI Session Control, version 6.0
ocxMAPIMessages    OCX   Microsoft MAPI Messages Control, version 6.0

ocxMAPISession.SignOn;
ocxMAPIMessages.SessionID := ocxMAPISession.SessionID;
ocxMAPIMessages.Compose;
ocxMAPIMessages.RecipAddress := 'email@address.com';
ocxMAPIMessages.MsgSubject := 'Subject of mail';
ocxMAPIMessages.MsgNoteText := 'Body of mail';
ocxMAPIMessages.Send;
ocxMAPISession.SignOff;

Does anyone has a clue, why this example cannot be executed correctly? ](*,)
Outlook 2007 is used BTW.

_________________
No support using PM or e-mail - Please use this forum.
Search is your friend || Mark your Topic as SOLVED (= green checkmark) when your question is answered || Read the Forum Rules before making a posting

»»» Mark your calendar: NAV TechDays 2013 - 7 & 8 November 2013 ««« Visit the conference website: www.navtechdays.com


Top
 Profile  
 
 Post subject: Re: How to send mail using MAPISession & MAPIMessages?
PostPosted: Wed Aug 19, 2009 6:09 pm 
Offline
Site Admin
MVP Microsoft Dynamics NAV
NAV TechDays 2013 attendee

Joined: Sun Nov 07, 1999 8:01 am
Posts: 3294
Location: Wilrijk
Country: Belgium (be)
I found a way to send mails, using automation ('Microsoft Outlook 12.0 Object Library'.MailItem).

It would be interested to know though, why the code from my previous posting isn't working. :-k

_________________
No support using PM or e-mail - Please use this forum.
Search is your friend || Mark your Topic as SOLVED (= green checkmark) when your question is answered || Read the Forum Rules before making a posting

»»» Mark your calendar: NAV TechDays 2013 - 7 & 8 November 2013 ««« Visit the conference website: www.navtechdays.com


Top
 Profile  
 
 Post subject: Re: How to send mail using MAPISession & MAPIMessages?
PostPosted: Mon Mar 04, 2013 8:32 pm 
Offline

Joined: Tue Jun 21, 2011 1:39 pm
Posts: 266
Country: Netherlands (nl)
I know it's an old topic. But why is everybody using codeunit 397 for sending email. Why not do it with ('Microsoft Outlook 12.0 Object Library'.MailItem).


Top
 Profile E-mail  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 8 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum


Search for:
Jump to: