Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Does MSMAPI require signon before compose?
Message
 
To
All
General information
Forum:
Visual FoxPro
Category:
Internet applications
Title:
Does MSMAPI require signon before compose?
Miscellaneous
Thread ID:
00583066
Message ID:
00583066
Views:
59
I have developed a component of my application that uses the msmapi activex controls to send an email message containing my application data to an email address stored in the application. It brings up the compose screen to allow the user to enter any text and review the attachments and email addresses. The users all use Outlook Express. My application works great except for one annoying thing: it immediately logs onto the mail server before bringing up the message compose screen. That is because it executes the signon method. Sometimes signing on takes a considerable amount of time, especially if an internet connection does not exist, in which case the modem needs to dial up, the password verified, etc. Sometimes the user just wants to save the message in the outbox, so signing on wastes time.

All the examples I've seen for using the msmapi controls do a signon before bringing up the compose screen. Trying to execute the compose method first causes an error. However, I have seen a number of applications that bring up the Outlook Express compose screen without first signing on. How is this done?

Thanks for your attention. Here is the code:

thisform.addobject("Session1","mapisess") && must subclass for license reason
thisform.addobject("Message1","mapimess") && class is in taistyle
* Call the Signon method of the MAPISession control. If the user is not
* logged into mail, this will prompt the user to sign on. This also sets
* the SessionId property for the MAPIsession control:
LOCAL lccurdir
lccurdir = CURDIR() && signon changes it
thisform.Session1.signon
* Set the SessionId of the MAPIMessage control to the SessionId of the
* MAPISession control, which was just obtained:
thisform.Message1.sessionid = thisform.Session1.sessionid
* Compose an e-mail message and set the subject line and Message text:
thisform.Message1.compose
FOR lncnt = 1 TO ALEN(lccusarray, 1)
IF NOT EMPTY(lccusarray(lncnt, 1))
*Index is base 0 while count is base 1.
thisform.Message1.recipIndex = thisform.Message1.recipCount
thisform.Message1.recipDisplayName=alltrim(lccusarray(lncnt,1))
thisform.Message1.recipAddress = ALLTRIM(lccusarray(lncnt,2))
IF thisform.Message1.recipIndex = 0
thisform.Message1.recipType = 1 && regular recipient
ELSE
thisform.Message1.recipType = 3 && bcc
endif
ENDIF
endfor
FOR lncnt = 1 TO ALEN(lcfacarray, 1)
IF NOT EMPTY(lcfacarray(lncnt, 1))
thisform.Message1.recipIndex = thisform.Message1.recipCount
thisform.Message1.recipDisplayName=ALLTRIM(lcfacarray(lncnt,1))
thisform.Message1.recipAddress = ALLTRIM(lcfacarray(lncnt,2))
IF thisform.Message1.recipIndex = 0
thisform.Message1.recipType = 1 && regular recipient
ELSE
thisform.Message1.recipType = 3 && bcc
endif
ENDIF
endfor
thisform.Message1.msgsubject = thisform.cHeading.caption
IF INLIST(thisform.destination.Value, 6, 8) && text or html email
thisform.Message1.msgnotetext;
= FILETOSTR(lccurdir + thisform.cPrintFileName + "." + lcext)
IF INLIST(LOWER(JUSTEXT(thisform.crepname)), "txt", "htm");
AND NOT EMPTY(thisform.cFilter)
thisform.Message1.AttachmentIndex = 0
thisform.Message1.AttachmentPathName = thisform.cFilter
* We have to increment the AttachmentPosition because two
* attachments cannot occupy the same space.
* The AttachmentPosition dictates the character position of the
* attachment, so stick them in after the message.
thisform.Message1.AttachmentPosition = 0
endif
ELSE
thisform.Message1.msgnotetext = "Please see the attached file."
IF thisform.chkattach.value
thisform.Message1.AttachmentIndex = 0
thisform.Message1.AttachmentPathName = thisform.cPrintFileName + "." + lcext
thisform.Message1.AttachmentPosition = 0
endif
endif
* Sends the e-mail message. The (1) is required to send the message.
thisform.Message1.send(1)
* Optionally, sign off from mail:
thisform.Session1.signoff
SET DEFAULT TO (lccurdir)
Next
Reply
Map
View

Click here to load this message in the networking platform