Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Sending email thru foxpro using yahoo or msn
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Sending email thru foxpro using yahoo or msn
Versions des environnements
Visual FoxPro:
VFP 9 SP2
Divers
Thread ID:
01439684
Message ID:
01439684
Vues:
204
I have a perfectly working email and texting program in my software, except when the user has yahoo or msn email accounts. They cannot get email or texting.

If they have their own email account thru other services it works perfectly. Anyone see what I need to change in my code ?

********************************************************************
*** Name.....: MAINSPORTSMANFORM.TEXT_MESSAGE
*** Author...: Don Higgins
*** Date.....: 12/17/2008
*** Notice...: Common Sense Software
*** Compiler.: Visual FoxPro 09.00.0000.2412 for Windows
*** Function.: Very simple Text Message or Email from within Crew Chief Pro Software
*** Returns..: Nothing, just sends out texts and emails
********************************************************************
*
* Parameter is whatever needs to be emailed or texted
*
* uses Comset.dbf file for settings and phone numbers
********
Lparameters tcMessage


Local lcSchema, loConfig, loMsg, loError, lcErr, lcTextBody, lcRecipient1, lcRecipient2, lcRecipient3, ;
	lcLogin, lcPassword, lcSMTPPort, lcSMTPServer, lcAllRecipients, lcBCC, lcCC


* did we get a message?  If not get out now
If Pcount() > 0
	lcTextBody = ALLTRIM( tcMessage )
ELSE
	* how this could happen is beyond me but get out now
	Return
Endif


* Open Comset.dbf and get setup information
Do openit In Main With "data\comset"

* up to 3 recipients
* these will be phone numbers @ vtext.com for example
* they can also be email addresses
lcRecipient1 = ALLTRIM(comset.rec1)
* if there is no rec1 then get the hell out also
* no reason to continue if there isnt anyone to send
If Empty(lcRecipient1)
	WAIT WINDOW "Ummmmm..... There is NO Phone Number to Text or Email - Exiting Now " TIMEOUT 5000
	Return
Endif
* OK we have at least one so lets get going
* 2nd person now.  Use Blind Carbon Copy for simplicity
lcRecipient2 = ALLTRIM(comset.rec2)
If .Not. Empty(lcRecipient2)
	* if not empty then do nothing except set variable for bcc
	lcBCC = lcRecipient2
Else
	lcBCC = ""
Endif

* 3rd person now
* uses Carbon Copy property
lcRecipient3 = ALLTRIM(comset.rec3)
If .Not. Empty(lcRecipient3)
	lcCC = lcRecipient3
Else
	lcCC = ""
Endif




* Now the setup info for the important stuff
lcLogin = comset.login
lcPassword = comset.pword
lcSMTPPort = comset.smtpport
lcSMTPServer = comset.servr

* close comset - can't afford corrupted files
SELECT comset
USE



lcErr = ""
lcSchema = "http://schemas.microsoft.com/cdo/configuration/"

loConfig = Createobject("CDO.Configuration")

With loConfig.Fields
	.Item(lcSchema + "smtpserver") = alltrim(lcSMTPServer)  &&"mail.crew-chief.com"
	.Item(lcSchema + "smtpserverport") = (lcSMTPPort)  &&587 && yr  smtp port &&
	.Item(lcSchema + "sendusing") = 2
	.Item(lcSchema + "smtpauthenticate") = .T.
	.Item(lcSchema + "smtpusessl") = .F.
	.Item(lcSchema + "sendusername") = alltrim(lcLogin)
	.Item(lcSchema + "sendpassword") = alltrim( lcPassword )
	.Update
Endwith

loMsg = Createobject ("CDO.Message")

With loMsg
	.Configuration = loConfig

	.From = "don@crew-chief.com"

	.To 	= lcRecipient1
	.bcc 	= lcBCC
	.cc		= lcCC
	
	*    .DSNOptions=2   & if u define this setting mails are not save at sender end

	.Subject = ""
	.TextBody = ( lcTextBody )

	* don't need attachments on this method so comment them out
	*.AddAttachment(GetFile())

	* 
	.Send()
	*
	
Endwith

If Vartype(loMsg)='O'
	WAIT WINDOW "Sent Information over the internet..." nowait
Else
	Messagebox('Error: Could Not Send - Something in your information is incorrect.  Contact us to get help', 16 , "Failed due to error")
Endif

Release lcMessage,lcSchema,loConfig,loMsg,loError,lcErr


* return to race just to be sure
SELECT race

Return
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform