Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
CDO Email with VFP
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Applications Internet
Divers
Thread ID:
00749445
Message ID:
00750525
Vues:
41
Here's some code for using CDO with whatever SMTP server is available (could be the one that comes with IIS):
IF llCDO
	#DEFINE cdoSendUsingPort 2
	#DEFINE smtpserverport 25
	#DEFINE smtpserver 'your.smtpserver.com' && 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
 .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
>Trying to send email using CDO, see code below. It works perfectly if i send an email to myself. But gives the following error if i sen the email to someone else. (Error - The server rejected recipient address... not a local host. Address not a gateway.
>
>omsg = CREATEOBJECT("cdo.message")
>omsg.To = alltrim(memail)
>omsg.From = alltrim(mcomp_name)
>omsg.Subject = ' Invoice '+ str(minvoice,6)
>oMSG.TextBody = mstrinvoicebody
>omsg.Send()
>
>CDO was configured by seting up outlook express.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform