No puedo conestar para enviar un E-Mail

No puedo conestar para enviar un E-Mail

Postby colthop » Fri Feb 22, 2008 6:10 pm

Hola amigos:

Estoy intentando enviar un email con la classe Tsmtp modificada por Luis Krause pero por mas que lo intento siempre me pone lo mismo:

SMTP services

Session did not complete successfully

Stage: ST_INIT
IP Adress: 213.4.149.228

Could not establish connection to smtp.telefonica.net

Lo que pongo es :

Procedure envio()
cHost := "smtp.telefonica.net"
cPort := 25
lAuth := .T.
lReceipt := .F.
cUser := "colthop$telefonica.net"
cReplyto := "colthop@telefonica.net"
cPass := "mar2000"
cSender := "colthop@telefonica.net"
cMsg := " "
SendMail( cHost, cSender, cReplyTo, cMsg, lReceipt, lAuth, cUser, cPass)
Return (NIL)

Static Function SendMail( cHost, cSender, cReplyTo, cMsg, lReceipt, lAuth, cUser, cPass )

LOCAL oInit

// initialize sockets (or nothing will happen) - it's a quirk in GetHostByName(), not TSmtp
oInit := TSmtp():New( cHost )
// no let's go for our socket
oMail := TSmtp():New(cHost, , lAuth, cUser, cPass ) // [jlalin], IBTC

oMail:cReplyTo := cReplyTo
oMail:nGMT := 1

// 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 := "c:\smtp.log"

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

oMail:SendMail( ;
cSender, ; // from/de
{ cSender }, ; // to/para (arreglo) - I use cSender here also because it's an "autotest". Actually you would type a different address here
"Hi guys:" + CRLF + "I've sent this from within FiveWin using TSmtp class" + CRLF + "This is just my first attempt to see if it works.",; // Body/Mensaje
"Testing SMTP class",; // Subject/Asunto
{ "a.prg" }, ; // Array of filenames to attach/Arreglo de nombres de archivos a agregar
{ }, ; // aCC
{ }, ; // aBCC
lReceipt,) // Return Receipt/acuse de recibo
* cMsg ) // msg in HTML format/mensaje en HTML

oInit:end()
Return .T.

Alguna alma caritativa que me pueda ayudar, gracias

Carlos
colthop
 
Posts: 505
Joined: Sat Apr 22, 2006 9:09 am
Location: Madrid - España

Postby MANOLO » Fri Feb 22, 2008 6:17 pm

Hola, yo tengo el mismo problema y con la clase modificada smtp no he logrado enviar emails mediante telefonica, siempre da error de autentificación, la solución que le dí es utilizar el minirelay que es un servidor smtp que se instala en el ordenador y no pasa por ningun servidor externo, con lo cual no hace falta autentificar, y la clase funcion perfectamente, también lo puedes hacer con yahoo, no hace falta autentificar.


saludos.
MANOLO
 
Posts: 87
Joined: Sun Oct 09, 2005 8:49 pm
Location: Spain

Postby colthop » Fri Feb 22, 2008 7:10 pm

Hola Manolo:

Me he bajado el MiniRelay pero sigo igual que antes he piuesto lo de 127.0.0.1 en vez de telefonica pero me dice lo mismo. Me podrias ayudar para hacer funcionar esta clase por el MiniRelay.

Gracias

Carlos
colthop
 
Posts: 505
Joined: Sat Apr 22, 2006 9:09 am
Location: Madrid - España

Postby Kleyber » Mon Feb 25, 2008 2:42 pm

A mi me ocurre algo similar. Cuando intento enviar un mail, me da la mensaje:

"The IP address 64.247.20.1 could not be resolved
Make sure you're connected to the internet and
check the firewall settings if applicable"

Que hago mal? Que debo hacer?

Gracias de antemano,
Kleyber Derick

FWH / xHb / xDevStudio / SQLLIB
User avatar
Kleyber
 
Posts: 581
Joined: Tue Oct 11, 2005 11:28 am
Location: São Luiz, Brasil

Postby MANOLO » Tue Feb 26, 2008 3:56 pm

colthop wrote:Hola Manolo:

Me he bajado el MiniRelay pero sigo igual que antes he piuesto lo de 127.0.0.1 en vez de telefonica pero me dice lo mismo. Me podrias ayudar para hacer funcionar esta clase por el MiniRelay.

Gracias

Carlos


Hola Carlos, perdona que no te contestara antes, pero he estado un poco liado, yo lo hago así:

en el mini relay tengo puesto lo siguiente:
* Ejecutar minirelay al iniciar windows. (marcado)
cerrar minirelay despues de.... ( sin marcar)
Crear log de envios (Sin marcar)
Iniciar en la bandeja de sistema (Marcado)
minimizar en la bandeja de sistema (Marcado)

y utilizo este código para enviar el email:

Code: Select all  Expand view
cHost   :="127.0.0.1"
cDesti1 := "123@yahoo.es" // este es el email de destino

Static Function envia(cTipoa,cHost,oBtn,cDestino,cFic,oBtn1,aCC)
Local oInit,oMail,cMsg,n,nVeces

oBtn1:disable()
oBtn1:refresh()

lenviado:=" "
      oInit := TSmtp():New( cHost ) // hemos de inicializar 2 veces el tsmtp para que funcione.....
      oMail := TSmtp():New( cHost,,.f.,"user","Password" ) // el minirelay no hace caso del usuario y el password, pon el que tu quieras....
*      oMail :cReplyTo := cReplyTo
      oMail:nGMT := +1                           // Pacific Standard Time
      oMail:nDelay := 2                               // default is 0
*        oMail:lTxtAsAttach := .F.                       // uncomment to force txt, log and htm files as inline as opposed to attachement
       oMail:oSocket:lDebug := .F.                     // uncomment to create log file
      oMail:oSocket:cLogFile := ".\smtp.log"
      oMail:bConnecting:= {|| (cSay1:="Conectando con el Servidor " + CHost + ", Esperando Respuesta...",oSay1:refresh()) }
      oMail:bConnected := {|| (cSay1:="Espere, Enviando Mensaje.",oSay1:refresh())}
*      oMail:bDone      := {|| lenviado:="S"  }
*      oMail:bFailure   := {|| lenviado:="N"  }
      oMail:cPriority  :="HIGH"
       oMail:bDone := {|| MsgInfo( ;
                     "Mensage Enviado Mediante " + oMail:cIPServer + CRLF + ;
                         GetHostByAddress( oMail:cIPServer ), "Información" ),cSay1:="Mensaje Enviado...",oSAy1:refresh() }
        oMail:bFailure := {|| ;
              MsgStop( "Se produjo un error, Mensaje no enviado..." + CRLF + CRLF + oMail:cError, "Atención" ),csay1:="Error en el envio...",oSay1:refresh() }

      cMsg := ;
               "Adjunto le enviamos el fichero con las salidas de hoy " + dtoc(date()) + CRLF + CRLF + ;
               "Sobre Cualquier Problema debe dirigirse a " + CRLF + ;
               ".................aaaaaaaaaa" + CRLF + ;
               "Telf. aaaaaaaaaaaa" + CRLF + ;
               "Fax . aaaaaaaaaaaa" + CRLF + ;
               "Contacto: aaaaaaaaaaaaa"
      oMail:SendMail( ;
            "123@yahoo.es", ;                                    // from aqui tienes que indicar el email de quien envia el mensaje
            { cDestino }, ;         // para
            cMsg,;                  // Mensaje
            "Fichero de Salidas",;  // Asunto
            { cFic }, ;             //  Arreglo de nombres de archivos a agregar
            aCC , ;                  // aCC
            { }, ;                  // aBCC
            .T., ;                  // acuse de recibo
            Nil )                   // msg in HTML format/mensaje en HTML

         oInit:end()
/*




Espero te sirva de algo.

Saludos.
Manolo

Code: Select all  Expand view
MANOLO
 
Posts: 87
Joined: Sun Oct 09, 2005 8:49 pm
Location: Spain

Postby dobfivewin » Mon Dec 22, 2008 8:50 pm

Amigos

Cual será el error:

Code: Select all  Expand view
#include "fivewin.ch"

procedure main


local cHost := "smtp.mailserver.jla.com.ar"
local cPort := 25
local lAuth := .T.
local lReceipt := .F.
local cUser := "dbarrio@jla.com.ar"
local cReplyto := "dbarrio@jla.com.ar"
local cPass := "DOB_JLA"
local cSender := "dbarrio@jla.com.ar"
local cMsg := " "
SendMail( cHost, cSender, cReplyTo, cMsg, lReceipt, lAuth, cUser, cPass)




Static Function SendMail( cHost, cSender, cReplyTo, cMsg, lReceipt, lAuth, cUser, cPass )

LOCAL oInit , oMail , oVentPrinc

// initialize sockets (or nothing will happen) - it's a quirk in GetHostByName(), not TSmtp
oInit := TSmtp():New( cHost )
// no let's go for our socket
oMail := TSmtp():New(cHost, , lAuth, cUser, cPass ) // [jlalin], IBTC

oMail:cReplyTo := cReplyTo
oMail:nGMT := 1

// 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 := "c:\smtp.log"

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

oMail:SendMail( ;
cSender, ; // from/de
{ cSender }, ; // to/para (arreglo) - I use cSender here also because it's an "autotest". Actually you would type a different address here
"Hi guys:" + CRLF + "I've sent this from within FiveWin using TSmtp class" + CRLF + "This is just my first attempt to see if it works.",; // Body/Mensaje
"Testing SMTP class",; // Subject/Asunto
{ "a.prg" }, ; // Array of filenames to attach/Arreglo de nombres de archivos a agregar
{ }, ; // aCC
{ }, ; // aBCC
lReceipt,) // Return Receipt/acuse de recibo
* cMsg ) // msg in HTML format/mensaje en HTML

oInit:end()
Return .T.
dobfivewin
 
Posts: 325
Joined: Sun Feb 03, 2008 11:04 pm
Location: Argetnina


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 64 guests