Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
MAPI with Attachments
Message
From
29/07/2003 00:34:36
 
General information
Forum:
Visual FoxPro
Category:
West Wind Web Connection
Miscellaneous
Thread ID:
00814212
Message ID:
00814424
Views:
18
Thank you VERY much. Your improved error method let me find out my problem was it could not find the attachment file - even though the attachment is in the same folder at the calling prg, the vcx etc. Once I used a fully qualified pathname with the filename I was able to get it to work.

Now, of course, there are the annoyances with the Outlook2000/XP security patches which prompt the user that somebody is sending a message - possibly a virus - on their behalf. There is also the issue that if Outlook is not actually running you have to pick the profile (I think I can steal some code from Megafox to get this from the registry instead) and AFAIK there is no way to actually have Outlook SEND the message rather than have it just sit in the outbox waiting for the next SEND.

But I think the hard part is done.

Now if I can just tweak Rick into supporting attachments for MAPI in WWIPstuff all this will be unnecessary < s >



>This class doesn't have a good error handler. You'll have to modify it to get actual OLE error.
PROCEDURE Error
>	LPARAMETERS tnError, tcMethod, tnLine
>	LOCAL laError[1]
>	IF tnError = 1429	
>		AERROR(laError)
>		This.AddError("VFP Error:" + LTrim(Str(tnError)) + ':' + ;
>				tcMethod + ':' + LTrim(Str(tnLine)) + ;
>				" :" + laError[3])
>	ELSE	
>		This.AddError("VFP Error:"+LTrim(Str(tnError))+':'+tcMethod+':'+LTrim(Str(tnLine)))
>	ENDIF	
>ENDPROC
>
Tell you truth, we are using this class for a couple of years and never had an error on the .send. Most likely MAPI isn't installed or configured properly on your PC.
>
>>This.nerrors=1 and at the point the error message in This.aerrors is VFP Error 1429 Sendmail 184
>>
>>
>>>In the sendmail method try to replace the last
RETURN 0
>>>* with
>>>RETURN This.nErrors
Or check o.geterrorcount() in addition to return value.
>>>
>>>>Once again I'm in awe of how quickly you can respond < s >
>>>>
>>>>I have tried the class and it appears to be working - i.e. the sendmail method returns 0 indicating no errors. Problem is, also no email. Stepping through the method code I find everything is exactly as expected until stepping into the .Send(llShowOutlook). There I find I'm in the error routine and the error is the 1429 OLE error. Oddly, the .send(llShowOutlook) doesn't effect the return value so the method leaves returning 0
>>>>
>>>>In any case, no clue as to what is going on now. It successfully created the mapi objects etc
>>>>
>>>>here's my test code:
>>>>
>>>>
>>>>
>>>>SET CLASSLIB TO mapimail.vcx additive
>>>>
>>>>o=CREATEOBJECT("cusmapi")
>>>>
>>>>lctext="This is the message to be sent by MAPI"
>>>>lcfile="mapimail.txt"
>>>>
>>>>lreturn = o.sendmail("SCHARNAS","asstcpa","chankey@f1tech.com","TEST",lctext,lcfile,.t.,.t.,.f.)
>>>>
>>>>RETURN "I AM DONE AND lreturn = "+STR(lreturn)
>>>>
>>>>


Charles Hankey

Though a good deal is too strange to be believed, nothing is too strange to have happened.
- Thomas Hardy

Half the harm that is done in this world is due to people who want to feel important. They don't mean to do harm-- but the harm does not interest them. Or they do not see it, or they justify it because they are absorbed in the endless struggle to think well of themselves.

-- T. S. Eliot
Democracy is two wolves and a sheep voting on what to have for lunch.
Liberty is a well-armed sheep contesting the vote.
- Ben Franklin

Pardon him, Theodotus. He is a barbarian, and thinks that the customs of his tribe and island are the laws of nature.
Previous
Reply
Map
View

Click here to load this message in the networking platform