¿Alguna funcion para enviar email desatendido xHarbour?

Re: ¿Alguna funcion para enviar email desatendido xHarbour?

Postby JoseAlvarez » Tue Jan 26, 2021 3:07 pm

Rick Lipkin wrote:Armondo

Use try\catch
Code: Select all  Expand view

Try
   oOutLook: = TOleAuto ( ) : New ( "Outlook.Application" )
Catch
    Saying: = "For some Odd reason The Outlook e-mail CLient failed to Initialize"
    Msginfo ( Saying )
    Return ( .f. )
End Try


 


Rick Lipkin


Good ! Thanks a Lot Rick !! :D
"Los errores en programación, siempre están entre la silla y el teclado..."

Fwh 19.06 32 bits + Harbour 3.2 + Borland 7.4 + MariaDB + TDolphin

Carora, Estado Lara, Venezuela.
User avatar
JoseAlvarez
 
Posts: 726
Joined: Sun Nov 09, 2014 5:01 pm

Re: ¿Alguna funcion para enviar email desatendido xHarbour?

Postby Armando » Tue Jan 26, 2021 3:11 pm

Rick:

Thanks a lot.

Regards
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
User avatar
Armando
 
Posts: 3061
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México

Re: ¿Alguna funcion para enviar email desatendido xHarbour?

Postby JoseAlvarez » Tue Jan 26, 2021 9:09 pm

Todavia sigo sin poder resolver el envio de email...

Alguna mano amiga ??
"Los errores en programación, siempre están entre la silla y el teclado..."

Fwh 19.06 32 bits + Harbour 3.2 + Borland 7.4 + MariaDB + TDolphin

Carora, Estado Lara, Venezuela.
User avatar
JoseAlvarez
 
Posts: 726
Joined: Sun Nov 09, 2014 5:01 pm

Re: ¿Alguna funcion para enviar email desatendido xHarbour?

Postby Victor Casajuana Mas » Wed Jan 27, 2021 6:42 am

Cuál es el problema exacto que tienes?

Enviado desde mi moto g(7) plus mediante Tapatalk
Victor Casajuana Mas
 
Posts: 6
Joined: Thu Jun 06, 2019 1:15 pm

Re: ¿Alguna funcion para enviar email desatendido xHarbour?

Postby acuellar » Wed Jan 27, 2021 12:45 pm

José

Intenta de ésta forma
Code: Select all  Expand view

Function EnviaCorreo(Cuerpo,Asunto,Adj)
 local oMsg := CreateObject( "CDO.Message" )
 local oConf := CreateObject( "CDO.Configuration" )
 local cSchema := "http://schemas.microsoft.com/cdo/configuration/"
 Local lOk := .T.,oError
 
oError:=NIL
TRY
 oConf:Fields[ cSchema + "smtpusessl" ] = .T.
 oConf:Fields[ cSchema + "smtpauthenticate" ] = 1
 oConf:Fields[ cSchema + "sendusername" ] = "cuenta@gmail.com"
 oConf:Fields[ cSchema + "sendpassword" ] = "password"
 oConf:Fields[ cSchema + "smtpserver" ] = "smtp.gmail.com"
 oConf:Fields[ cSchema + "sendusing" ] = 2
 oConf:Fields[ cSchema + "smtpserverport" ] = 465
       
 oConf:Fields:Update()

 oMsg:To = "cuenta_para@gmail.com"
 oMsg:From ="cuenta_de@gmail.com"
 oMsg:Subject = Asunto
 oMsg:HTMLBody = Cuerpo
 If !Empty(Adj)
   If File(Adj)
    oMsg:AddAttachment(Adj)
   Endif
 Endif
 oMsg:Configuration = oConf

 oMsg:Send()

CATCH oError
 MsgInfo("No pudo enviar el correo: " + oError:Description, "Error..." )
  lOk:=.F.
END

Return lOk
 
Saludos,

Adhemar C.
User avatar
acuellar
 
Posts: 1593
Joined: Tue Oct 28, 2008 6:26 pm
Location: Santa Cruz-Bolivia

Re: ¿Alguna funcion para enviar email desatendido xHarbour?

Postby postinelli » Wed Jan 27, 2021 1:12 pm

asi hago yo, y salen automaticamente los emails

Code: Select all  Expand view

//-----------------------------------------------------------------------------------------------
Function GMAILBK (cDestino,cAsunto,cTexto,cAdjunto )

Local oEmailCfg,oEmailMsg,oError,cHtml

Local cServer:= GetPvProfString("Enviador","SERVERSTP" ,"", cIniFile)
Local nPortEmail:=VAL(GetPvProfString("Enviador","EMAILPUERTO","25", cIniFile))
Local cEmailFrom:=GetPvProfString("Enviador","EMAILFROM" ,"", cIniFile)
Local cEmailUser:=GetPvProfString("Enviador","EMAILUSER" ,"", cIniFile)
Local cEmailPass:=GetPvProfString("Enviador","EMAILPASSW" ,"", cIniFile)
Local cEmailSsl:=GetPvProfString("Enviador","EMAILSSL" ,"NO", cIniFile)

DEFAULT cAdjunto:=""
DEFAULT cAsunto :=""
DEFAULT cTexto := ""

if Empty(cDestino )
msgAlert("no ha puesto un destinatario")
Return .f.
endif

TRY
oEmailCfg := CREATEOBJECT( "CDO.Configuration" )
WITH OBJECT oEmailCfg:Fields
:Item( "http://schemas.microsoft.com/cdo/configuration/smtpserver" ):Value := cServer //"smtp.fibertel.com.ar" //"smtp.live.com" ///"smtp.gmail.com"
:Item( "http://schemas.microsoft.com/cdo/configuration/smtpserverport" ):Value := nPortEmail //25 //465
:Item( "http://schemas.microsoft.com/cdo/configuration/sendusing" ):Value := 2 // Remote SMTP = 2, local = 1
:Item( "http://schemas.microsoft.com/cdo/configuration/smtpauthenticate" ):Value := .T.
if cEmailSsl='SI'
:Item( "http://schemas.microsoft.com/cdo/configuration/smtpusessl" ):Value := .T. //para ssl
else
:Item( "http://schemas.microsoft.com/cdo/configuration/smtpusessl" ):Value := .F. //para sin ssl
endif
:Item( "http://schemas.microsoft.com/cdo/configuration/sendusername" ):Value := cEmailUser //
:Item( "http://schemas.microsoft.com/cdo/configuration/sendpassword" ):Value := cEmailPass //
:Item( "http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout"):Value := 30
:Update()
END WITH
CATCH oError
MsgInfo( "No se ha enviado el " + ";" + ;
"Error: " + TRANSFORM(oError:GenCode, NIL) + ";" + ;
"SubC: " + TRANSFORM(oError:SubCode, NIL) + ";" + ;
"OSCode: " + TRANSFORM(oError:OsCode, NIL) + ";" + ;
"SubSystem: " + TRANSFORM(oError:SubSystem, NIL) + ";" + ;
"Message: " + oError:Description )
END
oError:=NIL

TRY
oEmailMsg := CREATEOBJECT ( "CDO.Message" )
WITH OBJECT oEmailMsg
:Configuration = oEmailCfg
:From = chr(34)+Empresa+' '+chr(34) + '<'+cEmailFrom+'>' // This will be displayed in the From (The email id does not appear)
:To = cDestino
:Subject = cAsunto
:MDNRequested = .T.
:TextBody = cTexto
if !Empty(cAdjunto)
:AddAttachment(cAdjunto)
endif

END WITH
oEmailMsg:Send()
CATCH oError
MsgInfo("No se ha enviado el mensaje" + ";" + CRLF+ ;
"Error: " + TRANSFORM(oError:GenCode, NIL) + ";" + CRLF+;
"SubC: " + TRANSFORM(oError:SubCode, NIL) + ";" + CRLF+ ;
"OSCode: "+ TRANSFORM(oError:OsCode, NIL) + ";" + CRLF +;
"SubSystem: " + TRANSFORM(oError:SubSystem, NIL) + ";" +CRLF+ ;
"Message: " + oError:Description )
END

// MsgInfo("Correo enviado correctamente")

Return .T.
//-----------------------------------------------------------------------------------------------


 
postinelli
 
Posts: 147
Joined: Tue Jul 15, 2008 7:12 pm
Location: Argentina

Re: ¿Alguna funcion para enviar email desatendido xHarbour?

Postby karinha » Wed Jan 27, 2021 1:27 pm

postinelli wrote:asi hago yo, y salen automaticamente los emails

Code: Select all  Expand view

//-----------------------------------------------------------------------------------------------
Function GMAILBK (cDestino,cAsunto,cTexto,cAdjunto )

Local oEmailCfg,oEmailMsg,oError,cHtml

Local cServer:= GetPvProfString("Enviador","SERVERSTP" ,"", cIniFile)
Local nPortEmail:=VAL(GetPvProfString("Enviador","EMAILPUERTO","25", cIniFile))
Local cEmailFrom:=GetPvProfString("Enviador","EMAILFROM" ,"", cIniFile)
Local cEmailUser:=GetPvProfString("Enviador","EMAILUSER" ,"", cIniFile)
Local cEmailPass:=GetPvProfString("Enviador","EMAILPASSW" ,"", cIniFile)
Local cEmailSsl:=GetPvProfString("Enviador","EMAILSSL" ,"NO", cIniFile)

DEFAULT cAdjunto:=""
DEFAULT cAsunto :=""
DEFAULT cTexto := ""

if Empty(cDestino )
msgAlert("no ha puesto un destinatario")
Return .f.
endif

TRY
oEmailCfg := CREATEOBJECT( "CDO.Configuration" )
WITH OBJECT oEmailCfg:Fields
:Item( "http://schemas.microsoft.com/cdo/configuration/smtpserver" ):Value := cServer //"smtp.fibertel.com.ar" //"smtp.live.com" ///"smtp.gmail.com"
:Item( "http://schemas.microsoft.com/cdo/configuration/smtpserverport" ):Value := nPortEmail //25 //465
:Item( "http://schemas.microsoft.com/cdo/configuration/sendusing" ):Value := 2 // Remote SMTP = 2, local = 1
:Item( "http://schemas.microsoft.com/cdo/configuration/smtpauthenticate" ):Value := .T.
if cEmailSsl='SI'
:Item( "http://schemas.microsoft.com/cdo/configuration/smtpusessl" ):Value := .T. //para ssl
else
:Item( "http://schemas.microsoft.com/cdo/configuration/smtpusessl" ):Value := .F. //para sin ssl
endif
:Item( "http://schemas.microsoft.com/cdo/configuration/sendusername" ):Value := cEmailUser //
:Item( "http://schemas.microsoft.com/cdo/configuration/sendpassword" ):Value := cEmailPass //
:Item( "http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout"):Value := 30
:Update()
END WITH
CATCH oError
MsgInfo( "No se ha enviado el " + ";" + ;
"Error: " + TRANSFORM(oError:GenCode, NIL) + ";" + ;
"SubC: " + TRANSFORM(oError:SubCode, NIL) + ";" + ;
"OSCode: " + TRANSFORM(oError:OsCode, NIL) + ";" + ;
"SubSystem: " + TRANSFORM(oError:SubSystem, NIL) + ";" + ;
"Message: " + oError:Description )
END
oError:=NIL

TRY
oEmailMsg := CREATEOBJECT ( "CDO.Message" )
WITH OBJECT oEmailMsg
:Configuration = oEmailCfg
:From = chr(34)+Empresa+' '+chr(34) + '<'+cEmailFrom+'>' // This will be displayed in the From (The email id does not appear)
:To = cDestino
:Subject = cAsunto
:MDNRequested = .T.
:TextBody = cTexto
if !Empty(cAdjunto)
:AddAttachment(cAdjunto)
endif

END WITH
oEmailMsg:Send()
CATCH oError
MsgInfo("No se ha enviado el mensaje" + ";" + CRLF+ ;
"Error: " + TRANSFORM(oError:GenCode, NIL) + ";" + CRLF+;
"SubC: " + TRANSFORM(oError:SubCode, NIL) + ";" + CRLF+ ;
"OSCode: "+ TRANSFORM(oError:OsCode, NIL) + ";" + CRLF +;
"SubSystem: " + TRANSFORM(oError:SubSystem, NIL) + ";" +CRLF+ ;
"Message: " + oError:Description )
END

// MsgInfo("Correo enviado correctamente")

Return .T.
//-----------------------------------------------------------------------------------------------


 


Mui bién. Cuasi perfecto.

Saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7214
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: ¿Alguna funcion para enviar email desatendido xHarbour?

Postby JoseAlvarez » Thu Jan 28, 2021 3:01 pm

Hola amigos,,,

Gracias Adhemar,
Gracias Postinelli,
Gracias Joao

Voy a probar estas sugerencias que me dan y les estare avisando por acá

seguimos en contacto
"Los errores en programación, siempre están entre la silla y el teclado..."

Fwh 19.06 32 bits + Harbour 3.2 + Borland 7.4 + MariaDB + TDolphin

Carora, Estado Lara, Venezuela.
User avatar
JoseAlvarez
 
Posts: 726
Joined: Sun Nov 09, 2014 5:01 pm

Re: ¿Alguna funcion para enviar email desatendido xHarbour?

Postby JoseAlvarez » Sun Jan 31, 2021 10:37 pm

Hola de nuevo..

Adhemar, funciono perfecto, muchisimas gracias por la ayuda.
Postinelli, tambien funciono a la primera.. agradecido por tu atencion.

Resuelto el problema que tenia.

Victor, gracias tambien por tu colaboracion y soporte.

Gracias al foro FW !!
"Los errores en programación, siempre están entre la silla y el teclado..."

Fwh 19.06 32 bits + Harbour 3.2 + Borland 7.4 + MariaDB + TDolphin

Carora, Estado Lara, Venezuela.
User avatar
JoseAlvarez
 
Posts: 726
Joined: Sun Nov 09, 2014 5:01 pm

Re: ¿Alguna funcion para enviar email desatendido xHarbour?

Postby Armando » Mon Feb 01, 2021 3:30 am

Rick:

Thank you.

Regards
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
User avatar
Armando
 
Posts: 3061
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México

Previous

Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 96 guests