In order for this site to work correctly we need to store a small file (called a cookie) on your computer. Most every site in the world does this, however since the 25th of May 2011, by law we have to get your permission first. Please abandon the forum if you disagree.
Para que este foro funcione correctamente es necesario guardar un pequeño fichero (llamado cookie) en su ordenador. La mayoría de los sitios de Internet lo hacen, no obstante desde el 25 de Marzo de 2011 y por ley, necesitamos de su permiso con antelación. Abandone este foro si no está conforme.
Para que este foro funcione correctamente es necesario guardar un pequeño fichero (llamado cookie) en su ordenador. La mayoría de los sitios de Internet lo hacen, no obstante desde el 25 de Marzo de 2011 y por ley, necesitamos de su permiso con antelación. Abandone este foro si no está conforme.
Alguien tiene un ejemplo de como usar alguna libreria de chilkat
- Carlos Ortiz
- Mensajes: 873
- Registrado: Mié Jul 01, 2009 5:44 pm
- Ubicación: Argentina - Córdoba
- Contactar:
-
- Mensajes: 40
- Registrado: Vie Oct 02, 2015 3:01 am
Re: Alguien tiene un ejemplo de como usar alguna libreria de chilkat
METHOD BtnBmp1Click( oSender ) CLASS TFormSendMail
LOCAL loMailman
LOCAL lnSuccess
LOCAL loEmail
LOCAL cFileXml
LOCAL cFilePDF
local cCarpetaXML := appdata:cPath + "xml" + appdata:empresa
local cCarpetaPDF := appdata:cPath + "pdf" + appdata:empresa
local lcContentType
cFileXml := cCarpetaXML+"\"+AllTrim(::cserie) + "_" + AllTrim(::cFactura) + ".xml"
cFilePDF := cCarpetaPDF+"\"+AllTrim(::cserie) + "_" + AllTrim(::cFactura) + ".pdf"
//-------------------------------------------------------------------
* The mailman object is used for sending and receiving email.
loMailman := CreateObject('Chilkat_9_5_0.MailMan')
* Any string argument automatically begins the 30-day trial.
lnSuccess := loMailman:UnlockComponent("Aqui va tu licencia")
IF (lnSuccess <> 1)
MsgInfo( loMailman:LastErrorText)
RELEASE loMailman
RETURN NIL
ENDIF
WITH OBJECT loMailman
* Set the SMTP server.
:SmtpHost := ::oSqlQueryEmpresa:smtphost
* Set the SMTP login/password (if required)
:SmtpUsername := ::oSQLQueryEmpresa:smtpuser
:SmtpPassword := ::oSqlQueryEmpresa:smtppwd
:SmtpPort := ::oSqlQueryEmpresa:smtpport
END WITH
* Create a new email object
loEmail := CreateObject('Chilkat_9_5_0.Email')
WITH OBJECT loEmail
:Subject = ::oEdit2:Value
:Body = ::oEdit3:Value
:From = ::oDBEdit2:value
lnSuccess := :AddTo(Application:aForms[3]:oSqlTable1:nombre,::oEdit1:cText)
lcContentType := :AddFileAttachment(cFileXml)
IF (:LastMethodSuccess <> 1)
MsgBox( :LastErrorText)
RELEASE loEmail
CANCEL
ENDIF
lcContentType := :AddFileAttachment(cFilePDF)
IF (:LastMethodSuccess <> 1)
MsgBox( :LastErrorText)
RELEASE loEmail
CANCEL
ENDIF
* To add more recipients, call AddTo, AddCC, or AddBcc once per recipient.
* Call SendEmail to connect to the SMTP server and send.
* The connection (i.e. session) to the SMTP server remains
* open so that subsequent SendEmail calls may use the
* same connection.
END WITH
lnSuccess := loMailman:SendEmail(loEmail)
IF (lnSuccess <> 1)
MsgInfo( loMailman:LastErrorText)
RELEASE loMailman
RELEASE loEmail
RETURN NIL
ENDIF
* Some SMTP servers do not actually send the email until
* the connection is closed. In these cases, it is necessary to
* call CloseSmtpConnection for the mail to be sent.
* Most SMTP servers send the email immediately, and it is
* not required to close the connection. We'll close it here
* for the example:
lnSuccess := loMailman:CloseSmtpConnection()
IF (lnSuccess <> 1)
MsgInfo( "La Connexion con el servidor SMTP no fue cerrada correctamente.")
ENDIF
MsgInfo( "Factura enviada exitosamente!")
RELEASE loMailman
RELEASE loEmail
RETURN Nil
LOCAL loMailman
LOCAL lnSuccess
LOCAL loEmail
LOCAL cFileXml
LOCAL cFilePDF
local cCarpetaXML := appdata:cPath + "xml" + appdata:empresa
local cCarpetaPDF := appdata:cPath + "pdf" + appdata:empresa
local lcContentType
cFileXml := cCarpetaXML+"\"+AllTrim(::cserie) + "_" + AllTrim(::cFactura) + ".xml"
cFilePDF := cCarpetaPDF+"\"+AllTrim(::cserie) + "_" + AllTrim(::cFactura) + ".pdf"
//-------------------------------------------------------------------
* The mailman object is used for sending and receiving email.
loMailman := CreateObject('Chilkat_9_5_0.MailMan')
* Any string argument automatically begins the 30-day trial.
lnSuccess := loMailman:UnlockComponent("Aqui va tu licencia")
IF (lnSuccess <> 1)
MsgInfo( loMailman:LastErrorText)
RELEASE loMailman
RETURN NIL
ENDIF
WITH OBJECT loMailman
* Set the SMTP server.
:SmtpHost := ::oSqlQueryEmpresa:smtphost
* Set the SMTP login/password (if required)
:SmtpUsername := ::oSQLQueryEmpresa:smtpuser
:SmtpPassword := ::oSqlQueryEmpresa:smtppwd
:SmtpPort := ::oSqlQueryEmpresa:smtpport
END WITH
* Create a new email object
loEmail := CreateObject('Chilkat_9_5_0.Email')
WITH OBJECT loEmail
:Subject = ::oEdit2:Value
:Body = ::oEdit3:Value
:From = ::oDBEdit2:value
lnSuccess := :AddTo(Application:aForms[3]:oSqlTable1:nombre,::oEdit1:cText)
lcContentType := :AddFileAttachment(cFileXml)
IF (:LastMethodSuccess <> 1)
MsgBox( :LastErrorText)
RELEASE loEmail
CANCEL
ENDIF
lcContentType := :AddFileAttachment(cFilePDF)
IF (:LastMethodSuccess <> 1)
MsgBox( :LastErrorText)
RELEASE loEmail
CANCEL
ENDIF
* To add more recipients, call AddTo, AddCC, or AddBcc once per recipient.
* Call SendEmail to connect to the SMTP server and send.
* The connection (i.e. session) to the SMTP server remains
* open so that subsequent SendEmail calls may use the
* same connection.
END WITH
lnSuccess := loMailman:SendEmail(loEmail)
IF (lnSuccess <> 1)
MsgInfo( loMailman:LastErrorText)
RELEASE loMailman
RELEASE loEmail
RETURN NIL
ENDIF
* Some SMTP servers do not actually send the email until
* the connection is closed. In these cases, it is necessary to
* call CloseSmtpConnection for the mail to be sent.
* Most SMTP servers send the email immediately, and it is
* not required to close the connection. We'll close it here
* for the example:
lnSuccess := loMailman:CloseSmtpConnection()
IF (lnSuccess <> 1)
MsgInfo( "La Connexion con el servidor SMTP no fue cerrada correctamente.")
ENDIF
MsgInfo( "Factura enviada exitosamente!")
RELEASE loMailman
RELEASE loEmail
RETURN Nil
- Carlos Ortiz
- Mensajes: 873
- Registrado: Mié Jul 01, 2009 5:44 pm
- Ubicación: Argentina - Córdoba
- Contactar:
Re: Alguien tiene un ejemplo de como usar alguna libreria de chilkat
Gracias colega, lo pruebo y te cuento (ando renegando con los ftp espero poder resolverlo)
Saludos desde Argentina
Saludos desde Argentina
@dbfarma
www.dbfarma.com.ar
www.dbfarma.com.ar
-
- Mensajes: 40
- Registrado: Vie Oct 02, 2015 3:01 am
Re: Alguien tiene un ejemplo de como usar alguna libreria de chilkat
muy buena lib, suerte