Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: surinder singh
  Where is surinder singh?
 mumbai
 India
 surinder singh
 To: Jyothish KV
  Where is Jyothish KV?
 Bangalore
 India
 Jyothish KV
 Tags
Subject: RE: Send Email
Thread ID: 209510 Message ID: 209519 # Views: 2 # Ratings: 0
Version: Visual FoxPro 6 Category: General VFP Topics
Date: Monday, December 29, 2008 11:42:14 AM         
   


> Hi Experts!
>
> Here is the code I use to send test email. (Author is one of the foxite member, Sorry for my ignorance to the author!)
>
> LPARAMETERS tcTo,tcFrom,tcSubject,tcBody
> ON ERROR DO showError WITH PROGRAM(1),PROGRAM(2),LINENO(),MESSAGE()
> IF PCOUNT()#4
> 	WAIT WINDOW "Must have 4 Parameters To,From,Subject, Bodytext" TIMEOUT 2
> 	RETURN .F.
> ENDIF
> LOCAL oMsg, oc,of
> #DEFINE cdoSendUsingMethod "http://schemas.microsoft.com/cdo/configuration/sendusing"
> #DEFINE cdoSendUsingPort 2
> #DEFINE cdoSMTPServer "http://schemas.microsoft.com/cdo/configuration/smtpserver"
> #DEFINE cdoSMTPServerPort "http://schemas.microsoft.com/cdo/configuration/smtpserverport"
> #DEFINE cdoSMTPConnectionTimeout "http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout"
> #DEFINE cdoSMTPAuthenticate "http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"
> #DEFINE cdoBasic 1
> #DEFINE cdoSendUserName "http://schemas.microsoft.com/cdo/configuration/sendusername"
> #DEFINE cdoSendPassword "http://schemas.microsoft.com/cdo/configuration/sendpassword"
> 
> 
> oMsg = CREATEOBJECT("CDO.Message")
> IF TYPE("oMsg")#"O"
> 	RETURN .F.
> ENDIF
> oMsg.To = tcTo
> oMsg.From = tcFrom
> oMsg.Subject = tcSubject
> oMsg.TextBody = tcBody
> *oMsg.AddAttachment(GETFILE(""))
> 
> * set up config
> oc=CREATEOBJECT("CDO.Configuration")
> of=oc.Fields
> WITH of
> 	.Item(cdoSendUsingMethod)       = cdoSendUsingPort
> 	.Item(cdoSMTPServer)            = "smtp.gmail.com" &&for Gmail
> 	.Item(cdoSMTPServerPort)        = 465 &&for Gmail
> 	.Item(cdoSMTPConnectionTimeout) = 10
> 	.Item(cdoSMTPAuthenticate)      = cdoBasic
> 	.Item(cdoSendUserName)          = "kvjyothish"
> 	.Item(cdoSendPassword)          = "mypassword"
> 	.Update
> ENDWITH
> * update the changes
> omsg.Configuration = oc
> bb=oMsg.Send &&Taken off the () when used in VFP6 by Jyotish
> oMsg = NULL
> of = NULL
> oc = NULL
> RELEASE oMsg
> RELEASE of
> RELEASE oc
> IF TYPE("bb")<>"U"
> 	=MESSAGEBOX("Message Successfully sent!",64,"Send Mail")
> 	RETURN bb
> ELSE
> 	=MESSAGEBOX("Message sending failed!",16,"Send Mail")
> ENDIF	
> ON ERROR
> *
> FUNCTION showError()
> PARAMETERS lcProg1,lcProg2,lnLin,lcMsg
> 	=MESSAGEBOX("Program: "+lcProg1+CHR(13)+;
> 				"Module : "+lcProg2+CHR(13)+;
> 				"Line No: "+ALLTRIM(STR(lnLin))+CHR(13)+;
> 				"Error  : "+lcMsg,16,"Program Error")
> RETURN 0

>
> This code is working fine in VFP9. But having problem with VFP6. I'm getting the follOwing error!
>
> Could anyone tell me what is the reason this did not support by VFP6? Whether CDO does not support in VFP 6.0?? Is there any way I can use it in VFP6? Because my client is using VFP6.0 version currently. Thanks in advance!
>
> Regards,
> Jyothish
Gmail uses SSL:

.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = 1


-----------------------------------------------------------------------------------------------
Regards
Surinder Singh
Email: sur200@indiatimes.com
Check my blog for details: http://weblogs.foxite.com/sur200
----------------------------------------------------------------------------------------
*Everything is possible but everything is not required to be happy..

ENTIRE THREAD

Send Email Posted by Jyothish KV @ 12/29/2008 11:19:06 AM
RE: Send Email Posted by surinder singh @ 12/29/2008 11:42:14 AM
RE: Send Email Posted by Jyothish KV @ 12/29/2008 2:36:21 PM