Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
MAPI Send And Continue ? Also Error Handling ?
Message
 
 
To
08/11/2001 21:09:23
Mike Foley
Madec Computing Ltd
Dublin, Ireland
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00579479
Message ID:
00584733
Views:
31
>Hi
>
>I've just started using (for the first time) the MSMAPI stuff, I've downloaded the code from MSDN. I've managed to use MSMAPI.mapiSession and MSMAPI.mapiMessages to generate a message, with a sunject and attachment.
>
>When I issue the SEND command, what I would like to happen is that the E-mail is generated and appears but then control returns to VFP so that I can quit the application. I dont want VFP to hang around waiting for the SEND to finish or work or otherwise. (for various reasons) Any suggestions on how this can be done ? (It must be possible as lots of apps generate e-mails and then leave them their open while they continue working ?
>
>Also, if I choose Cancel on the e-mail it generates a Foxpro Error, I would prefer if just returned the detail in a Var or something. Is there a way to turn this off or just does it have to be handled in On Error or something.
>
>One last thing, I've noticed that the MSAPI seems to be changing the Defauly Directory, so I have had to re-issue a SET DEFAULT TO command. Any idea why this is happening or is it normal ?
>
>Thanks for any help.
>
>Mike
Mike I'm not quite sure this is what you're looking for...
PROCEDURE SayErrFile
    cGenericMess="Errors Occured and Reported in ERR_RPT.TXT"
    IF nERRCNT > 0 
        loWSH=CreateObject("Wscript.Shell")    && Eliminate DOS Window Flash!
        loWSH.run("command /c net send <loginname> &cGenericMess ",0,1)
        loWSH=NULL
        oApp=CreateObject("Outlook.Application")
        NameSpace= oApp.GetNameSpace("MAPI")
        MailItem = oApp.CreateItem(0)
        cAutoSubject= "Automatic Err Notification!"
        With MailItem
            .Subject =  cAutoSubject
            .body= CHR(10)+" Today "+TTOC(DATETIME( ))+ CHR(10)+CHR(13);
               +cemailline1+ CHR(13);
               +cemailline2+ CHR(13);
               +cemailline3+ CHR(13);
               +cemailline4+ CHR(13);
               +cemailline5+ CHR(13);
               +cemailline6+ CHR(13);
               +cemailline7+ CHR(13)
            .Recipients.Add ("<emailname>@<eplace>.com")
            .Send
        EndWith
        NameSpace.Logoff
    ENDIF
    IF SubStr(cDestFolder,1,1)= "C"     && ERR WHILE Testing SHOW ME
        MODIFY FILE ERR_RPT.TXT               && debug code
    ENDIF
ENDPROC
Edgar L. Bolton, B.S. B.B.A.
Previous
Reply
Map
View

Click here to load this message in the networking platform