viernes, 11 de agosto de 2017

Envío de correo

MySession is EmailSMTPSession
MyMessage is Email
myAttach  is EmailAttach
sFile     is string
MySession..ServerAddress = "smtp.miempresa.com.mx"
// The TLS port depends on the provider, don't forget to check it!
MySession..Port = 2525
MySession..Name = "gmero@miempresa.com.mx"
MySession..Password = "secrEto*"

EmailSetTimeOut(10)
IF EmailStartSession(MySession) = False THEN
 Error("no se pudo iniciar la sesión SMTP", ErrorInfo())
 RETURN
END

EmailReset(MyMessage)
MyMessage..Sender = "gmero@miempresa.com.mx"
MyMessage..SenderAddress = "gmero@miempresa.com.mx"
Add(MyMessage..Recipient, "yootro@otraempresa.com.mx")
MyMessage..Subject = "Prueba desde windev"
MyMessage..Message = "Hola Mundo 1"

//adjunto el archivo anexo
// Select the file to attach
sFile = EDT_File
// Build the EmailAttach variable if exist
IF fFileExist(sFile) = True
myAttach..Name = fExtractPath(sFile, fFileName)
myAttach..Content = fLoadText(sFile)
myAttach..ContentType = "application/pdf"
myAttach..ContentDescription = "A PDF document"
// Add the attachment
Add(MyMessage..Attach, myAttach)
END
EmailSendMessage(MySession,MyMessage)
EmailCloseSession(MySession)

No hay comentarios.:

Publicar un comentario

Try catch end

 // -------------------------------------------------- // Procedure principal que executa uma query com tratamento de exceção // -----------...