Page 1 of 1

no me funciona CDOSYS, gmail

PostPosted: Fri May 29, 2015 1:38 am
by noe aburto
Saludos.

En ascuas.

Con la funcion que mensiono abajo, funciona con mi cuenta de gmail en google, pero no con otras de gmail
mis datos, son:

[img]c:\tmp\mail2.jpg[/img]

y con los que no funciona:

[img]c:\tmp\mail1.jpg[/img]

y entramos a google gmail con la que no funciona y si entra con el usuario y contraseña.

alguna ayuda.

Re: no me funciona CDOSYS, gmail

PostPosted: Fri May 29, 2015 1:40 am
by noe aburto
Oigan foreros:

nunca he pegado imagenes ni codigo fuente en los mensajes, ayuda.....

Re: no me funciona CDOSYS, gmail

PostPosted: Fri May 29, 2015 1:42 am
by noe aburto
funcion:

Function fSendMail( cMailServer, cFrom, cTo, cSubject, cBody, cAttach, cBCC, cUser, cPass, nPort, oDlg )
Local oCfg, oMsg, oError, nEle, cToken, bMens, lAuth:=!Empty(cUser).and.!Empty(cPass)
Local aAttach:={}

Default nPort := 25, ;
cSubject := "", ;
cBody := ""

if !IsInternet()
aviso({'ATENCION','No existe conección a internet','Intente más tarde o verifique su problema'})
return .t.
endif
If "GMAIL.COM" $ Upper( cMailServer ) .and. ( Empty( cUser ) .or. Empty( cPass ) )
MsgStop( "Con GMail son requeridos nombre de usuario y contraseña", "Atención" )
Return .t.
EndIf
CursorWait()
bMens:=Mensaje('Destino: '+AllTrim(cTo),'Espere, enviando un Mail')

nEle := 1
While ! Empty( cToken := StrToken( cAttach, nEle++, "," ) )
AAdd( aAttach, cToken )
End

aviso(aAttach)

Try

oCfg := CreateObject( "CDO.Configuration" )

With Object oCfg:Fields
:Item( cdoSMTPServer ):Value := AllTrim( cMailServer )
:Item( cdoSMTPServerPort ):Value := nPort /////// es el 465 /////
:Item( cdoSendUsing ):Value := 2
If lAuth
:Item( cdoSMTPAuthenticate ):Value := .T.
:Item( cdoSendUserName ):Value := AllTrim( cUser )
:Item( cdoSendPassword ):Value := AllTrim( cPass )
:Item( cdoSMTPUseSSL ):Value := .T.
EndIf
:Item( cdoSMTPConnectionTimeout ):Value := 30
:Update()
End With

oMsg := CreateObject( "CDO.Message" )

With Object oMsg
:Configuration := oCfg
:From := AllTrim( cFrom )
:To := AllTrim( cTo )
:Subject := AllTrim( cSubject )
:TextBody := AllTrim( cBody )
For nEle := 1 To Len( aAttach )
if File( AllTrim( aAttach[ nEle ] ) )
:AddAttachment := AllTrim( aAttach[ nEle ] )
else
Aviso({'El archivo adjunto '+Upper(AllTrim( aAttach[ nEle ] )),;
'no será enviado, no existe'})
endif
Next
If ! Empty( cBCC )
:BCC := AllTrim( cBCC )
EndIf

:Send()
End With

CATCH oError
Eval(bMens)
CursorArrow()
MsgInfo ( "Error envio de EMail" + CRLF + ;
"Remitente: " + AllTrim( cFrom ) + CRLF + ;
"Destinatario: " + AllTrim( cTo ) + CRLF + ;
"Error: " + TRANSFORM ( oError:GenCode, NIL ) + ";" + CRLF + ;
"SubC: " + TRANSFORM ( oError:SubCode, NIL ) + ";" + CRLF + ;
"Codigo: " + TRANSFORM ( oError:OsCode, NIL ) + ";" + CRLF + ;
"SubSistema: " + TRANSFORM ( oError:SubSystem, NIL ) + ";" + CRLF + ;
"Mensaje: " + oError:Description, "Atención" )
oCfg := Nil
oMsg := Nil
Return ( .F. )
END

oCfg := Nil
oMsg := Nil
Eval(bMens)
SndPlaySound( GetWinDir() + "\media\Tada.wav", 0 )
CursorArrow()
if oDlg<>NIL
oDlg:End()
endif
Return ( .T. )

Re: no me funciona CDOSYS, gmail

PostPosted: Fri May 29, 2015 1:44 am
by joseluisysturiz
noe aburto wrote:Oigan foreros:

nunca he pegado imagenes ni codigo fuente en los mensajes, ayuda.....

Debes subir las imagenes a un servidor de esos gratuitos, luego buscas el link que te dan que dice para foros, lo pefgas aca y listo, saludos... :shock:

Re: no me funciona CDOSYS, gmail

PostPosted: Fri May 29, 2015 3:19 am
by FranciscoA

Re: no me funciona CDOSYS, gmail

PostPosted: Fri May 29, 2015 4:46 am
by noe aburto
Saludos..

Enhorabuena....

Hice justo lo que me indicaron de activar en la cuenta de gmail las zonas seguras y todo bien.

gracias.