Get email.

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

User avatar
hmgchang
Posts: 273
Joined: Tue Aug 13, 2013 4:46 am
Location: Indonesia

Re: Get email.

Post by hmgchang »

This is my ssw :

Code: Select all

#include <hmg.ch>
#include 'hfcl.ch'
#include "hbclass.ch"
#include "simpleio.ch"

#require "hbtip"
#require "hbssl"

REQUEST __HBEXTERN__HBSSL__

Function Main

        Load Window Main
        Main.Center
        Main.Activate

Return

FUNCTION btnGetMail_Action()
  // The example outlines the steps required for retrieving all
  // eMails from a POP mail server and how to decompose
  // incoming mail messages.

  LOCAL oPop, oPart, aParts, oTIpMail, aEmails, i
  
  cUser      := "hmgchang@gmail.com"
  cPassword  := "hmg123456"
  cPopServer := "pop.gmail.com" && "imap.googlemail.com" && 
  cUser      := STRTRAN( cUser, "@", "&at;")
  
  cTUrl := "pop://" + cUser + ":" + cPassword + "@" + cPopServer
  oUrl := TUrl():New( cTUrl)
  
  IF oUrl == NIL
    msgDebug( "Error : " + cTUrl)
    RETURN NIL
  ENDIF  
  
  oPop := TIpClientPop():new( oUrl, .F.)
  
  IF oPop == NIL
    msgDebug( "oPop := TIpClientPop():new( oUrl, .F.)")
    RETURN NIL
  ENDIF  
  
  cUser := STRTRAN( cUser, "&at;", "@")
  oPop:oUrl:cUserId := cUser
  
  oPop:nConnTimeout := -1

  *- oPop := TIpClientPop():new( "pop://mailaccount:password@pop.server.com" )
  *- oPop := TIpClientPop():new( "pop://" + cMailAccount + ":" + cPassword + "@" + cPopServer )

  IF .NOT. oPop:open()
     msgDebug( "Connection error:", oPop:lastErrorMessage(), "oPop:open()")
     QUIT
  ELSE
     aEMails := oPop:retrieveAll()
     oPop:close()
  ENDIF

  FOR i:=1 TO Len( aEMails )
     oTIpMail := aEmails[i]
     msgDebug( "From : ", oTIpMail:getFieldPart( "From" ))
     msgDebug( "Subject : ", oTIpMail:getFieldPart( "Subject" ))

     IF oTIpMail:isMultiPart()
        // Retrieve all parts of a multipart message
        aParts := oTIpMail:getMultiParts()

        FOR EACH oPart IN aParts
           IF .NOT. Empty( oPart:getFileName() )
              // This is a file attachment. Store it in the TMP folder.
              IF oPart:detachFile( "C:\tmp\" )
                 msgDebug( "Attach file :", "File written: C:\tmp\" + oPart:getFileName())
              ENDIF
           ELSE
              msgDebug( "GetBody :", oPart:getBody())
           ENDIF
        NEXT
     ELSE
        // simple mail message
        msgDebug( "Simple GetBody : ", oTIpMail:getBody())
     ENDIF
  NEXT
  RETURN NIL
  
I also download and installed the vcredist_x86.exe and Win32OpenSSL_Light-1_0_1i.exe.
But i got this message :
Attachments
enetunreach.JPG
enetunreach.JPG (19.7 KiB) Viewed 3575 times
Just Hmg It !
Javier Tovar
Posts: 1275
Joined: Tue Sep 03, 2013 4:22 am
Location: Tecámac, México

Re: Get email.

Post by Javier Tovar »

Hola DanielMaximiliano,

El primer archivo adjunto no subio?, por que no selecciona nada para bajar.

Saludos
User avatar
danielmaximiliano
Posts: 2612
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Contact:

Re: Get email.

Post by danielmaximiliano »

Hola Chang... This is my ssw
message.jpg
message.jpg (21.22 KiB) Viewed 3534 times
InOutEmail.rar
(1.92 KiB) Downloaded 248 times
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
Javier Tovar
Posts: 1275
Joined: Tue Sep 03, 2013 4:22 am
Location: Tecámac, México

Re: Get email.

Post by Javier Tovar »

Disculpa DanielMaximiliano, es que al traducir la pagina al español, ya no sale tu primer archivo que subiste y mostrando la pagina original SI.

No me di cuenta hasta ahorita.

Saludos
User avatar
hmgchang
Posts: 273
Joined: Tue Aug 13, 2013 4:46 am
Location: Indonesia

Re: Get email.

Post by hmgchang »

Thank you very much Master Daniel,
i will download and meditate on it...

best regards,
Chang
Just Hmg It !
User avatar
hmgchang
Posts: 273
Joined: Tue Aug 13, 2013 4:46 am
Location: Indonesia

Re: Get email.

Post by hmgchang »

Dear Daniel,

After filling in the user and password...
i tried to run your ssw....
this is what i got..
Connection Info
Connection Info
ConnectionInfo.JPG (14.36 KiB) Viewed 3484 times
and this is the ssw...
ChangGetMail.zip
(2.33 KiB) Downloaded 230 times
Pls advise and TIA

best rgds,
Chang
Just Hmg It !
User avatar
hmgchang
Posts: 273
Joined: Tue Aug 13, 2013 4:46 am
Location: Indonesia

Re: Get email.

Post by hmgchang »

Dear master,

FYI,...
i can successfully login the gmail account by my browser...
Just Hmg It !
User avatar
danielmaximiliano
Posts: 2612
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Contact:

Re: Get email.

Post by danielmaximiliano »

hmgchang wrote:Dear Daniel,

After filling in the user and password...
i tried to run your ssw....
this is what i got..
need not indicate @gmail or @gmail.com this server

Code: Select all

  cUser          := "hmgchang" 
  cPassword      := "hmg123456"
Attachments
changuser.jpg
changuser.jpg (20.04 KiB) Viewed 3464 times
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
User avatar
hmgchang
Posts: 273
Joined: Tue Aug 13, 2013 4:46 am
Location: Indonesia

Re: Get email.

Post by hmgchang »

Dear Daniel....
I tried and it works...
Thank you very much....
and sorry for causing you troubles...

best rgds,
Chang
Just Hmg It !
User avatar
danielmaximiliano
Posts: 2612
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Contact:

Re: Get email.

Post by danielmaximiliano »

hmgchang wrote:Dear Daniel....
I tried and it works...
Thank you very much....
and sorry for causing you troubles...

best rgds,
Chang

are pleased to help Chang
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
Post Reply