No puedo conestar para enviar un E-Mail
Posted: 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
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