Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using CDO with VFP
Message
 
To
02/03/2004 09:19:09
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Miscellaneous
Thread ID:
00882316
Message ID:
00882319
Views:
17
Mine works without the error and the differences I see are that I'm using
NEWOBJECT instead of CreateObject and I set the object to NULL at the end.
Here's my code(from ActiveVFP):
#DEFINE cdoSendUsingPort 2
#DEFINE smtpserverport 25
#DEFINE smtpserver 'localhost' && replace with your SMTP server

LOCAL loMsg
loMsg = NEWOBJECT("CDO.Message")

WITH loMsg
		IF !EMPTY(oRequest.FORM("txtMailFrom"))
	   		.FROM = oRequest.FORM("txtMailFrom")
	   	ENDIF
	   	IF !EMPTY(oRequest.FORM("txtMailTo"))
	   		.TO = oRequest.FORM("txtMailTo")
	   	ENDIF
	   	IF !EMPTY(oRequest.FORM("txtMailBcc"))
	   		.BCC = oRequest.FORM("txtMailBcc")
	   	ENDIF
	   	IF !EMPTY(oRequest.FORM("txtMailSubject"))
	   		.Subject = oRequest.FORM("txtMailSubject")
	   	ENDIF
	   	IF !EMPTY(oRequest.FORM("S1"))
	   		.TextBody = oRequest.FORM("S1")
	   	ENDIF
	   	IF !EMPTY(oRequest.FORM("txtMailAttachment"))
	   	    .AddAttachment = oRequest.FORM("txtMailAttachment")
	   	ENDIF
	   .Configuration.FIELDS("http://schemas.microsoft.com/cdo/configuration/sendusing").VALUE = 1
	   .Configuration.FIELDS("http://schemas.microsoft.com/cdo/configuration/sendusing").VALUE = cdoSendUsingPort
	   .Configuration.FIELDS("http://schemas.microsoft.com/cdo/configuration/smtpserver").VALUE = smtpserver
	   .Configuration.FIELDS("http://schemas.microsoft.com/cdo/configuration/smtpserverport").VALUE = smtpserverport
	   .Configuration.FIELDS.UPDATE
	   .SEND
ENDWITH
loMsg = NULL
>I have the following code in my application:
>
>oMail = createobject("CDO.Message")
>oMail.To = "lhaslem@hotmail.com"
>oMail.Subject = "Test"
>oMail.TextBody = "This is a test message"
>oMail.Send()
>Release oMail
>
>When I run this is my application, the e-mail is sent but I get an oApp not found error message when it finishes. Any ideas?
>
>Lawrence
Previous
Reply
Map
View

Click here to load this message in the networking platform