Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Send report by mail
Message
 
À
04/01/2005 12:00:57
Sammy Derban
Ghana Telecom
Accra, Ghana
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 6 SP5
OS:
Windows XP
Database:
Visual FoxPro
Divers
Thread ID:
00974114
Message ID:
00974142
Vues:
27
First i generate an HTML version with XFRX (very good product!) and with VFP9 Fox generates HTML output in reports.

Next i compose an email with ANSMTP
( http://www.emailarchitect.net/webapp/smtpcom ) with the following code:
-------------------------------------------------------------------

_VFP.AutoYield = .F.

lcEmailPath = SOME FOLDER....

IF !DIRECTORY(lcEmailPath)
MD &lcEmailPath
ENDIF

*** Name of the file to create
lcFileName = JUSTSTEM(Thisform.nombrearchivo)
lcEmailPath = SYS(5) + ADDBS(lcEmailPath)+lcFileName+"_files\"


IF !DIRECTORY(lcEmailPath)
AVISO("Error en el directorio de trabajo - 1")
RETURN
ENDIF

** si el fichero pasado como parámetro no existe, me voy
Thisform.nombrearchivo = HTML version of report

*** mail object
loMailObj = CREATEOBJECT("ANSMTP.OBJ")


TestANSMTP(loMailObj) && here i fit the control license


loMailObj.ServerAddr = ALLTRIM(Thisform.txtSMTPServer.Value) && Servidor SMTP
loMailObj.From = ALLTRIM(Thisform.txtFromName.Value) && Display del remitente
loMailObj.FromAddr = ALLTRIM(Thisform.txtFrom.Value) && E-Mail remitente
loMailObj.Subject = ALLTRIM(Thisform.txtSubject.Value)


loMailObj.AddRecipient( ALLTRIM(Thisform.txtTo.Value), ALLTRIM(Thisform.txtTo.Value), 0 )


*** Tema de E-mail - Lo importo del fichero HTML generado por XFRX
loMailObj.ImportMailEx( Thisform.nombrearchivo )

*** Autentificación
IF !EMPTY(Thisform.txtUsuario.Value) AND !EMPTY(Thisform.txtPassword.Value)
loMailObj.NTLMAuth = 0 && si fuera Exchange habría que poner un 1
loMailObj.UserName = ALLTRIM(Thisform.txtUsuario.Value)
loMailObj.Password = ALLTRIM(Thisform.txtPassword.Value)
ENDIF

lnReturnCode = loMailObj.SendMail() && send mail message

IF lnReturnCode = 0
WAITWCTR("Mensaje enviado correctamente", .T.)
SLEEP(3000)
ELSE
AVISO("ERROR:"+loMailObj.GetLastErrDescription())
ENDIF

RELEASE loMailObj

IF lnReturnCode = 0
Thisform.Release()
ENDIF
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform