getmail HMG

HMG en Español

Moderator: Rathinagiri

Post Reply
User avatar
jairpinho
Posts: 251
Joined: Mon Jul 18, 2011 5:36 pm
Location: Rio Grande do Sul - Brasil
Been thanked: 5 times
Contact:

getmail HMG

Post by jairpinho » Sun Oct 30, 2011 10:57 pm

hello group
I wonder if there is any function that can read an email from a mailbox, I want to develop a mailbox to receive and send emails to the same outlook
Jair Pinho
HMG ALTA REVOLUÇÃO xBASE
HMG xBASE REVOLUTION HIGH
http://www.hmgforum.com.br

User avatar
danielmaximiliano
Posts: 2090
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Has thanked: 115 times
Been thanked: 15 times
Contact:

Post by danielmaximiliano » Mon Oct 31, 2011 3:12 pm

Ola Jair:
dejo una contribucion de Lucho

Code: Select all

Aquí pego el fuente para envíos desde Yahoo.es ...  para los colegas que quieran utilizarlo ... sirve para xHarbour Modo Consola Windows y Linux.



REQUEST DBFNTX
REQUEST DBFDBT

#ifdef __PLATFORM__Windows
  ANNOUNCE HB_GTSYS
  REQUEST HB_GT_WIN_DEFAULT
#endif

PROCEDURE main()
envia_mail()
RETURN(.T.)

function envia_mail()
LOCAL oSmtp
LOCAL oEMail
LOCAL cSmtpUrl
LOCAL cSubject
LOCAL cFrom
LOCAL cTo
LOCAL cBody
LOCAL cFile
Local cUrl := "smtp://lmonterof:miclave@smtp.mail.yahoo.es" // ejemplo para una cuenta en Yahoo.es
Local oUrl

oUrl:= TUrl():new( cUrl )
oUrl:cuserid := "lmonterof@yahoo.es"
   // preparing data for eMail
cSmtpUrl := "smtp://lmonterof@yahoo.es:miclave@smtp.mail.yahoo.es"
cSubject := "Prueba de Email"
cFrom    := "lmonterof@yahoo.es"
cTo      := "luis.montero@gpsinka.com"
cFile    := "archivo.zip"
cBody    := "Envio de prueba desde xharbour a las: " + DTOC(DATE()) + " " + Time()

      // preparing eMail object
oEMail   := TIpMail():new()
oEMail:setHeader( cSubject, cFrom, cTo )
oEMail:setBody( cBody )
oEMail:attachFile( cFile )

      // preparing SMTP object
oSmtp := TIpClientSmtp():new( oUrl )
osmtp:nDefaultport := 587               // Con este puerto tambien me funciona aunque yahoo tiene el 465


      // sending data via internet connection

@ 15, 11 say "SERVER: " + ourl:cServer
@ 16, 11 say "USERID: " + ourl:cUserid
@ 17, 11 say "PASSWORD: " + ourl:cPassword
@ 18, 11 say "PUERTO: " + transform(ourl:nPort,'99999')
@ 20, 11 say " "
wait "Presiona una tecla"
IF oSmtp:open()

   if oSmtp:sendMail( oEMail )
      @ 14, 11 say "Correo Enviado"
   else
      @ 14, 11 say "Correo no se Envio"
   endif
   oSmtp:close()
ELSE
   @ 14, 11 say "Correo no se Abrio"
ENDIF
wait "Fin de envio de correo"
RETURN .t.


Saludos.
Atte.
Lucho Montero.
LIMA - PERU.
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`.HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. : +54901169026142
Telegram Name : DaNiElMaXiMiLiAnO

User avatar
jairpinho
Posts: 251
Joined: Mon Jul 18, 2011 5:36 pm
Location: Rio Grande do Sul - Brasil
Been thanked: 5 times
Contact:

Post by jairpinho » Mon Oct 31, 2011 7:29 pm

Sim Daniel ja uso para enviar preciso de uma função que receba os email que nem o outlook quero fazer uma caixa de correio onde se pode enviar e receber emails de uma caixa postal, mas valeu pela dica.
Jair Pinho
HMG ALTA REVOLUÇÃO xBASE
HMG xBASE REVOLUTION HIGH
http://www.hmgforum.com.br

User avatar
danielmaximiliano
Posts: 2090
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Has thanked: 115 times
Been thanked: 15 times
Contact:

Post by danielmaximiliano » Mon Oct 31, 2011 9:10 pm

*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`.HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. : +54901169026142
Telegram Name : DaNiElMaXiMiLiAnO

User avatar
mol
Posts: 3070
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Has thanked: 180 times
Been thanked: 96 times
Contact:

Post by mol » Tue Nov 01, 2011 7:54 am

I've placed program for sending mails here:

viewtopic.php?f=5&t=260&start=10


Best regards, Marek

Post Reply