Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Outlook/MAPI dialogs on sending email
Message
From
09/08/2002 08:26:27
 
 
To
09/08/2002 02:28:14
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00686099
Message ID:
00687909
Views:
36
>Hi Ed,
>
>Thanks for the reply, actually I have tried in the Nigel Coates' MAPIMAIL class, but nothing happened.
>
>This is part of code in methode sendmail from the class :
>
>
>* Create message object
>THIS.oMessage=CREATEOBJECT("MSMAPI.MAPIMessages.1")
>WITH THIS.oMessage
>	.SessionID=lnSessionID

Have you checked to see if you are getting beyond the point where the MAPI
message is initiated?  As mentioned in my original posting, there are two
points at which Outlook may cause the dialog to trigger, once when the MAPI
message is first created, and again when the created message is sent. The 
modal dialog may be triggered before the point at which you call the script
prior to the Send method below.

>	.Compose()
>	.MsgIndex=-1
>	.MsgNoteText=THIS.cBodyText
>	.MsgSubject=THIS.cSubject
>	.MsgReceiptRequested=llReceipt
>	.RecipDisplayName=THIS.aRecipients[1]
>	* Multiple recipients
>	FOR lnLoop=2 TO ALEN(THIS.aRecipients,1)
>		.RecipIndex=.RecipCount
>		.RecipDisplayName=THIS.aRecipients[lnLoop]
>	ENDFOR
>	* Copy recipients
>	IF THIS.nCCRecipCount>0
>		FOR lnLoop=1 TO ALEN(THIS.aCCRecipients,1)
>			.RecipIndex=.RecipCount
>			.RecipDisplayName=THIS.aCCRecipients[lnLoop]
>			.RecipType=2
>		ENDFOR
>	ENDIF
>	* Blind copy recipients
>	IF THIS.nBCCRecipCount>0
>		FOR lnLoop=1 TO ALEN(THIS.aBCCRecipients,1)
>			.RecipIndex=.RecipCount
>			.RecipDisplayName=THIS.aBCCRecipients[lnLoop]
>			.RecipType=3
>		ENDFOR
>	ENDIF
>	* Add any required attachment files
>	lnAttachPos=(LEN(THIS.cBodyText)-ALEN(THIS.aAttachmentFiles,1))-1
>	IF NOT EMPTY(THIS.aAttachmentFiles[1])
>		.AttachmentPosition=lnAttachPos
>		.AttachmentPathName=THIS.aAttachmentFiles[1]
>		* Multiple attachment files
>		FOR lnLoop=2 TO ALEN(THIS.aAttachmentFiles,1)
>			.AttachmentIndex=.AttachmentCount
>			lnAttachPos=lnAttachPos+1
>			.AttachmentPosition=lnAttachPos
>			.AttachmentPathName=THIS.aAttachmentFiles[lnLoop]
>		ENDFOR
>	ENDIF
>	RUN /N7 cscript waitforoutlook.vbs  -> this is your script

Have you checked to make sure that CSCRIPT.EXE is installed and in the Win32
search path? In addition, you may be having a problem with the native VFP
RUN command in your OS; by using /N7, you are launching the app inactive
and minimized - try using /N3 instead, since as you've coded it, it might
never get focus, and would never call AppActivate() or SendKeys() as a
result. Better yet, don't use RUN, use API_APPRUN and use LaunchApp() to
run the script (do not use LaunchAppAndWait() since VFP would not receive
focus again until the script completes, and the script, never activating
the Outlook dialog, since the MAPI method would not be called to create the
dialog, might never terminate.)

>	.Send(llShowOutlook)
>ENDWITH
>
>
>regards,
>

I've used this with both the SendMAPIMail() method of wwIPStuff calling the script immediately before SendMAPIMail(); with direct Outlook automation, I need to call it twice (once on Outlook.Application's CreateItem() and once on calling the MailItem's Send().)

I only use MAPI to send email where either (1) the SMTP server requires a separate secured login to use the SMTP service or (2) where I need to retain an exact replica of the email in the MAPI client's SentMail folder. Using SMTP tends to be a lot faster, and doesn't depend on MAPI client behavior.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform