Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Mails with Cdo
Message
De
07/05/2013 17:06:08
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire de rapports & Rapports
Titre:
Mails with Cdo
Divers
Thread ID:
01572955
Message ID:
01572955
Vues:
119
My problemn is this: I'm trying to transform a report output in Vfp9 to a .htm file. This I do with the HTMLListener.
LOCAL oHtml
SET PATH TO (HOME() + "FFC") ADDITIVE
oHtml = NEWOBJECT("HtmlListener","_reportlistener.vcx")
oHtml.TargetFileName = "c:\caja\datos\Informe.htm"
oHtml.QuietMode = .T.
oHtml.xsltParameters = CREATEOBJECT("Collection")
oHtml.xsltParameters.Add(6, "numberPrecision")
oHtml.externalFileLocation = ".\images"
oHtml.copyImageFilesToExternalFileLocation = .T.
REPORT FORM total_xcuenta OBJECT oHtml
I get the file "Informe.htm". If I click on it the explorer opens and there it is, my vfp report in it.

Then I try to send a mail with my .htm file displayed in it.
OCAL ceMailRemitente as String, cContrasena as String, cTitulo as String, cTexto as String
ceMailRemitente = "olgagaya@GMAIL.com"
cContrasena = "PaulaSunde"
cTitulo = "Caja - Totales x cuenta === Período " + DTOC(thisform.txtFechaInicial.Value) + " - " + DTOC(thisform.txtFechaFinal.Value)
cTexto = "tita 8"

LOCAL cEsquema as String, oCDO as Object, oMsg as Object, oError as Object
cEsquema = "http://schemas.microsoft.com/cdo/configuration/"

TRY
oCDO = CREATEOBJECT("CDO.Configuration")
oMsg = CREATEOBJECT("CDO.Message")

WITH oCDO.Fields
DO CASE
CASE "GMAIL" $ Upper(ceMailRemitente)
.Item(cEsquema + "smtpserver") = "smtp.gmail.com"
.Item(cEsquema + "smtpserverport") = 465
.Item(cEsquema + "sendusing") = 2
.Item(cEsquema + "smtpauthenticate") = .T.
.Item(cEsquema + "smtpusessl") = .T.
OTHERWISE
WAIT WINDOW NOWAIT "No puedo enviar este e-mail. No conozco los parámetros necesarios del servidor de correo"
ENDCASE

.Item(cEsquema + "sendusername") = ceMailRemitente
.Item(cEsquema + "sendpassword") = cContrasena
.Update()
ENDWITH

WITH oMsg
.Configuration = oCDO
.From = "Olga Gaya " + ceMailRemitente
.To = thisform.cDestinatarios
.Subject = cTitulo

.CreateMHTMLBody("file://c:\caja\datos\informe.htm", 0)

.Fields.Update
.Send()

WAIT WINDOW NOWAIT 'Los eMails para ' + thisform.cNombres + ' fueron enviados exitosamente.'
ENDWITH

CATCH TO oError
MESSAGEBOX("No pudieron enviarse los eMails" + CHR(13) + "Error Nº: " + TRANSFORM(oError.ErrorNo) + CHR(13) + "Mensaje: " + oError.Message)
FINALLY
ENDTRY
And it works. Or almost. Because the page looses its format. Everything is placed on the left side.
Do you know why the file is not displayed as originally?

Thanks for any answer
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform