Envio de Email con WEBHOSTING

Envio de Email con WEBHOSTING

Postby wyerco » Tue Jul 27, 2010 12:23 am

Estimados Colegas

He tratado de enviar emails desde mi programa probando de muchas formas y todavia no tengo resultados. Prove con CDOSYS y para gmail funciona bien pero lo que es vital que se pueda manejar con hosting empresariales, el smtp en mi caso es "mail.easycomp.cl" y ocupo el correo contacto@easycomp.cl con el puerto 25, pero sale el tipico error ya nombrado varias veces.

¿ Alguien tiene un ejemplo funcionando con un hosting empresarial ? Les agradesco mucho su ayuda porque es Urgente!!!!!

Waldemar González

Bendiciones
¡ Dios es nuestra fortaleza !
User avatar
wyerco
 
Posts: 58
Joined: Thu Aug 14, 2008 9:35 pm
Location: Santiago - Chile

Re: Envio de Email con WEBHOSTING

Postby anserkk » Tue Jul 27, 2010 6:09 am

This sample is working fine for me. I have used my SMTP server hosted with a web hosting company to send the mail to my gmail id.

Code: Select all  Expand view
#Include "FiveWin.ch"

Function Main()
    Local oEmailCfg,oEmailMsg

    TRY
       oEmailCfg := CREATEOBJECT( "CDO.Configuration" )
      WITH OBJECT  oEmailCfg:Fields
         :Item( "http://schemas.microsoft.com/cdo/configuration/smtpserver" ):Value :=   "mail.xxxxxxxx.com"
         :Item( "http://schemas.microsoft.com/cdo/configuration/smtpserverport" ):Value :=  25
         :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.
         :Item( "http://schemas.microsoft.com/cdo/configuration/smtpusessl" ):Value :=  .F.
         :Item( "http://schemas.microsoft.com/cdo/configuration/sendusername" ):Value :=  "xxanser@xxxxxxxx.com"
         :Item( "http://schemas.microsoft.com/cdo/configuration/sendpassword" ):Value :=  "xxxxxx"
         :Item( "http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout"):Value := 30
         :Update()
      END WITH
    CATCH oError
      MsgInfo( "Could not create message configuration" + ";"  + ;
             "Error: " + TRANSFORM(oError:GenCode, NIL) + ";" + ;
             "SubC: " + TRANSFORM(oError:SubCode, NIL) + ";" + ;
             "OSCode: " + TRANSFORM(oError:OsCode, NIL) + ";" + ;
             "SubSystem: " + TRANSFORM(oError:SubSystem, NIL) + ";" + ;
             "Message: " + oError:Description )
       Return .F.
    END
    oError:=NIL


    TRY
     oEmailMsg := CREATEOBJECT ( "CDO.Message" )
     WITH OBJECT oEmailMsg
        :Configuration =  oEmailCfg
        :From = chr(34)+" Anser K.K. "+chr(34)+ "<anser@xxxxxxxx.com>" // This will be displayed in the From (The email id does not appear)
        :To = "xxanserkk@xxxxx.com"    // <-----   Place the TO email address
        :Subject =  "This is a Tst message"
        :ReplyTo =  "xxanser@xxxxxxxxx.com"
        :Sender =  "xxanser@xxxxxxxxx.com"  // Read Receipt message is send to this
        :Organization =  "My xxxxxx Company"    // "My Company Name"
        :HTMLBody =  "<HTML> Hello  </HTML>"
        :Send()
     END WITH
     SysRefresh()
    CATCH oError
       
       MsgInfo( "Could not send message" + ";"  + 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 )
       Return .F.
   
    END
    MsgInfo("Email Send")

Return


Image


Regards
Anser
User avatar
anserkk
 
Posts: 1331
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Re: Envio de Email con WEBHOSTING

Postby Carlos Mora » Tue Jul 27, 2010 6:53 am

Waldemar,

wyerco wrote:He tratado de enviar emails desde mi programa probando de muchas formas y todavia no tengo resultados. Prove con CDOSYS y para gmail funciona bien pero lo que es vital que se pueda manejar con hosting empresariales, el smtp en mi caso es "mail.easycomp.cl" y ocupo el correo contacto@easycomp.cl con el puerto 25, pero sale el tipico error ya nombrado varias veces.

Es cierto, el problema que tenemos al usar CDO es que no tenemos un buen control de errores, y si algo está mal no podemos saber a ciencia cierta que es.
Aún así, CDO bien configurado no tiene problemas para enviar correos. Los hostings empresariales no tienen ninguna particularidad, asegúrate cuales son las condiciones del servicio. El protocolo smtp es muy estandar, lo que suele cambiar son la forma de autenticarse. Eventualmente los antivirus están bloqueando el puerto 25 a las aplicaciones, habría que asegurarse que ese no es tu caso.
Es más fácil ayudarte si pones el trozo de código donde pones los parámetros para saber que puede estar mal. Revisa los parámetros de configuración.
Prueba de usar esos parametros con tu cliente de correo y verifica que funcionan los parámetros que estas usando. Si funciona, copia la imagen de la configuracion de tu cliente de correos y el código para ver si el problema son los parámetros.
Saludos
Carlos Mora
http://harbouradvisor.blogspot.com/
StackOverflow http://stackoverflow.com/users/549761/carlos-mora
“If you think education is expensive, try ignorance"
Carlos Mora
 
Posts: 988
Joined: Thu Nov 24, 2005 3:01 pm
Location: Madrid, España

Re: Envio de Email con WEBHOSTING

Postby wyerco » Wed Jul 28, 2010 12:06 am

Anser

Thanks for your help, in fact your example it works exelent and thanks all people that gave me a hand too.

Thank you very much.

Best regards

Waldemar González

God Bless you :D :lol:
¡ Dios es nuestra fortaleza !
User avatar
wyerco
 
Posts: 58
Joined: Thu Aug 14, 2008 9:35 pm
Location: Santiago - Chile

Re: Envio de Email con WEBHOSTING

Postby mariordz » Mon Apr 23, 2012 9:29 pm

Hello everyone, I just tried this code and it works when there are not attachments, but if I add the line:

:AddAttachment := AllTrim( cArchp )

Then I get the following error:

Could not send message;
Error: 13;
SubC: 1004;
OSCode: 0;
SubSystem: BASE;
Message: Class: 'NIL' has no exported method

Any suggestion?

Thanks in advance.
User avatar
mariordz
 
Posts: 131
Joined: Tue Dec 26, 2006 4:50 pm
Location: Ciudad de México

Re: Envio de Email con WEBHOSTING

Postby anserkk » Tue Apr 24, 2012 6:35 am

:AddAttachment := AllTrim( cArchp )


1. Please check the value/data in the variable named cArchp. Hope that it is not empty
2. cArchp should contain the full path of the file that you are trying to attach For Eg:"D:\Test\List.Doc"
3. The file that you are trying to attach should exist in the path that you have specified.

Code: Select all  Expand view
If !Empty(cArchp)
   :AddAttachment := AllTrim( cArchp )
Endif


Regards

Anser
User avatar
anserkk
 
Posts: 1331
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Re: Envio de Email con WEBHOSTING

Postby thefull » Tue Apr 24, 2012 2:14 pm

Put path complete;

Fail;
.\file.txt

Ok;
c:\temp\file.txt

Regards
Saludos
Rafa Carmona ( rafa.thefullARROBAgmail.com___quitalineas__)
User avatar
thefull
 
Posts: 729
Joined: Fri Oct 07, 2005 7:42 am
Location: Barcelona

Re: Envio de Email con WEBHOSTING

Postby mariordz » Thu Apr 26, 2012 5:18 pm

Thanks guys for your response, I added a little stop showing the value of the variable "cArchp", it shows the full path to the file I want to send. I must have started by telling you I am using a old versión of Fivewin (2.6), it might be the problem, if it is not and you guys have anothe suggestion it will be welcomed.

Thanks
User avatar
mariordz
 
Posts: 131
Joined: Tue Dec 26, 2006 4:50 pm
Location: Ciudad de México


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 52 guests