Page 1 of 1

TSMTP de Luis Krause / Tamaño 0 en ficheros adjuntos

PostPosted: Sun Aug 05, 2007 7:05 pm
by RPATON
Hola:
Estoy utilizando la clase TSMTP de Luis Krause para envío de ficheros .ZIP junto con el mensaje.
El mensaje se envío pero el tamaño del fichero que llega es cero.

¿Que puedo estar haciendo mal?

Saludos.
Ricardo Patón


FUNCTION SendMail(cMailDes)
LOCAL oInit

// initialize sockets (or nothing will happen) - it's a quirk in GetHostByName(), not TSmtp
oInit := TSmtp():New( alltrim(empre2->ipsmtp) )

// no let's go for our socket
oMail := TSmtp():New( alltrim(empre2->ipsmtp), , empre2->laut, alltrim(empre2->usuario), alltrim(empre2->clave), "ENVIO FICHEROS MAESTROS" ) // [jlalin], IBTC
* oMail:cReplyTo := cReplyTo
oMail:nGMT := 8 // 8 = Pacific Standard Time (GMT -08:00) - Adjust this to your own Time Zone!

// uncomment next line if you experience problems while sending email
// descomentar sig. l¡nea en caso de experimentar problemas al enviar correo
oMail:nDelay := 1

* oMail:lTxtAsAttach := .F. // uncomment to force txt, log and htm files as inline as opposed to attachement
oMail:oSocket:lDebug := .T. // uncomment to create log file
oMail:oSocket:cLogFile := "smtp.log"

* oMail:bConnecting := {|| oWnd:SetMsg( "Connecting to " + cHost + " (" + oMail:cIPServer + ") and waiting for response..." ) }
* oMail:bConnected := {|| oWnd:SetMsg( "Connected and sending mail and attachments..." ) }

oMail:SendMail( ;
alltrim(empre2->mailori), ; // from/de
{ alltrim(cMailDes) }, ; // to/para (arreglo) - I use cSender here also because it's an "autotest". Actually you would type a different address here
"Ficheros Maestros para AUXTAJO",; // Body/Mensaje
"Ficheros Maestros:"+dtoc(date())+" "+time(),; // Subject/Asunto
{"c:\prueba.zip" }, ; // Array of filenames to attach/Arreglo de nombres de archivos a agregar
{ }, ; // aCC
{ }, ; // aBCC
.F., ; // Return Receipt/acuse de recibo
"" ) // msg in HTML format/mensaje en HTML

oInit:end()

return nil

TSMTP solucion adjuntar ficheros

PostPosted: Mon Aug 06, 2007 3:25 pm
by RPATON
Hola:
Resuelto el problema. SendFile de TSOCKET.PRG no veía el fichero temporal que se genera con TmpFile(). Le he puesto una ruta fija y todo funciona bien recibiendo el fichero con tamaño.

Saludos.

Ricardo Patón

PostPosted: Mon Aug 06, 2007 5:42 pm
by Antonio Linares
Gracias Ricardo por compartir la solución :-)