Page 1 of 1

autodescarga de adjuntos en correo

Posted: Thu Nov 14, 2019 5:32 pm
by edufloriv
Saludos amigos,

¿ Alguien tiene código en HMG para descargar, de manera automática, los archivos adjuntos que llegan a un correo y depositarlos en una carpeta específica ?

Actualmente lo estoy haciendo con el propio Outlook y un código VB que encontré por allí (vía macros) - Pero cuando windows decide actualizar, corta algunos servicios, y dicho código no se ejecuta y tengo que realizar la descarga de manera manual, la verdad me hace perder bastante tiempo.

Me gustaría tener yo el control de esta automatización vía código HMG.

Agradeciendo su gentil ayuda, reciban cordiales saludos.


Att.

Re: autodescarga de adjuntos en correo

Posted: Thu Nov 14, 2019 7:52 pm
by edk

Re: autodescarga de adjuntos en correo

Posted: Fri Nov 15, 2019 2:06 am
by jparada
Hola Eduardo,
Yo hice hace un tiempo algo parecido, solo que no sé a qué te refieras con automático... :?...

Este ejemplo utiliza el cliente de correo Outlook y lo que hace es que debes seleccionar la carpeta de Outlook desde la cual deseas extraer los archivos adjuntos y seleccionar el folder destino, hay algunos inconvenientes que en su momento no pude resolver y son que no funciona si quieres extraer los adjuntos de subfolders, es decir, no lee los subfolders de Outlook y otro detalle es que lee TODOS los correos del folder que selecciones, es decir, si son demasiados correos, hay un momento que marca error, esto se debería resolver haciendo un filtro por día/hora de los correos que te interesan, pero eso tampoco lo pude resolver en su momento..., total que funcionaba para lo que yo requería en aquel entonces...

A ver si te es útil y sobre todo si lo mejoras lo puedas compartir.

Saludos,
Javier

Re: autodescarga de adjuntos en correo

Posted: Fri Nov 15, 2019 3:31 pm
by edk
Working demo with Gmail account.
Remember to configure Gmail accounts in the security section to allow less secure applications and enable POP support.

Re: autodescarga de adjuntos en correo

Posted: Fri Nov 15, 2019 9:55 pm
by AUGE_OHR
hi,
edk wrote: Thu Nov 14, 2019 7:52 pm Some clue: http://hmgforum.com/viewtopic.php?p=36585#p36585
i have download
unzip the libraries in their respective folders within your installation HMG.3.3.1 :
hmg.3.3.1.rar
Lib and lib64 folder
(2.44 MiB) Downloaded 164 times
replace hmb.hbc to include these new libraries
hmg.3.3.1.hbc.rar
(743 Bytes) Downloaded 117 times
and rebuild the libraries using buildalllib.bat and buildalllib64.bat
i can run BuildLib32.bat without Error but when run BuildAllLib32.bat i got Error
Compiling 'source\h_HMG_Zebra.prg'...
source\h_HMG_Zebra.prg(56) Error F0032 Invalid name follows #
hbmk2: Error: Running Harbour compiler (embedded). 1
...
hbmk2: Hint: Add option 'xhb.hbc' for missing function(s): CreateObject(),
GetDefaultPrinter()
hbmk2: Error: Referenced, missing, but unknown function(s): GETPROPERTY(),
HMG_UPPER(), HMG_LEN(), SETPROPERTY(), _DEFINEHOTKEY(),
_RELEASEHOTKEY(), _DEFINETEXTBOX(), GETCONTROLINDEX(),
_DEFINEMODALWINDOW(), GETTITLEHEIGHT(), GETBORDERWIDTH(),
GETBORDERHEIGHT(), _DEFINEMASKEDTEXTBOX(), _DEFINECHARMASKTEXTBOX(),
_DEFINELISTBOX(), _ENDWINDOW(), _ACTIVATEWINDOW(), DOMETHOD(),
STOPCONTROLEVENTPROCEDURE(), INSTALLMETHODHANDLER(), GETCONTROLTYPE(),
APRINTERS(), MSGINFO(), MSGSTOP(), _HMG_PARSEGRIDCONTROLS(),
_BEGINTAB(), _BEGINTABPAGE(), _DEFINEGRID(), _ENDTABPAGE(),
_DEFINELABEL(), _DEFINECOMBO(), _DEFINECHECKBOX(), _BEGINFRAME(),
_DEFINEBUTTON(), _DEFINEIMAGEBUTTON(), _DEFINEMIXEDBUTTON(), _ENDTAB(),
_STARTSTATUSBAR(), _DEFINESTATUSBARITEM(), _ENDSTATUSBAR(),
_ISCONTROLDEFINED(), _HMG_PRINTER_SETPRINTERPROPERTIES(),
HMG_ISNOTDEFPARAM(), _HMG_PRINTER_INITUSERMESSAGES(), BEGININI(),
_SETINI(), _ENDINI(), _HMG_HPDF_STARTDOC(), _HMG_PRINTER_SETJOBNAME(),
_HMG_PRINTER_STARTDOC(), _HMG_HPDF_STARTPAGE(),
_HMG_PRINTER_STARTPAGE_PREVIEW(), GETTEMPFOLDER(),
_HMG_PRINTER_STARTPAGE(), _HMG_HPDF_PRINT(), _HMG_PRINTER_H_PRINT(),
_HMG_HPDF_LINE(), _HMG_PRINTER_H_LINE(), _HMG_HPDF_ENDPAGE(),
_HMG_PRINTER_ENDPAGE_PREVIEW(), _HMG_PRINTER_ENDPAGE(),
_HMG_HPDF_ENDDOC(), _HMG_PRINTER_SHOWPREVIEW(), _HMG_PRINTER_ENDDOC(),
_ISWINDOWACTIVE(), GETTEXTWIDTH(), GETPRINTABLEAREAHORIZONTALOFFSET(),
GETPRINTABLEAREAVERTICALOFFSET(), GETPRINTABLEAREAWIDTH(),
GETPRINTABLEAREAHEIGHT(), ERASEWINDOW(), DRAWRECT(), DRAWLINE(),
HMG_ISDIGIT(), _GETINI(), MSGYESNO(), _DELINISECTION(),
_ISWINDOWDEFINED(), MSGHMGERROR(), GETFORMHANDLE(), _GETID(),
CREATEQHTM(), _SETFONT(), SETWINDOWTEXT(), QHTM_LOADFILE(),
QHTM_LOADRES(), QHTM_FORMCALLBACK(), _GETCONTROLFREE(),
GETCONTROLHANDLE(), QHTM_GETNOTIFY(), QHTM_SETRETURNVALUE(),
QHTM_GETSCROLLPOS(), QHTM_SETSCROLLPOS(), GETWINDOWHEIGHT(),
QHTM_GETSIZE(), SENDMESSAGE(), QHTM_SETZOOMLEVEL(), GETDESKTOPFOLDER(),
RICHEDITBOX_RTFLOADRESOURCEFILE(), RICHEDITBOX_STREAMINEX(),
RICHEDITBOX_STREAMOUTEX(), RICHEDITBOX_GETTEXT(),
_HMG_PRINTER_PRINTDIALOG_EX(), CLIENTTOSCREEN(), SCREENTOCLIENT()
so i do not understand what is going on while BuildAllLib32.bat call BuildLib32.bat

Code: Select all

@echo off
SET HMGPATH=%~dp0
SET PATH=%HMGPATH%\harbour\bin;%HMGPATH%\mingw\bin;%PATH%
CALL BuildLib32.bat /nopause
Question : do i need other BuildAllLib32.bat :?:

Re: autodescarga de adjuntos en correo

Posted: Sat Nov 16, 2019 6:09 am
by AUGE_OHR
hi,

the Error was while my BuildAllLib32.bat fail ... i have to re-build in 2 Steps
1.) BuildLib32.bat
2.) only Part of BuildAllLib32.bat ( Environment are set before with BuildLib32.bat )

Code: Select all

@echo off
rem SET HMGPATH=%~dp0
rem SET PATH=%HMGPATH%\harbour\bin;%HMGPATH%\mingw\bin;%PATH%
rem CALL BuildLib32.bat /nopause

rem start here
SET HMGPATH=%~dp0
SET PATH=%HMGPATH%\harbour\bin;%HMGPATH%\mingw\bin;%PATH%
rem hbmk2 hmg.hbp
now it work ... but i have to change Syntax

Code: Select all

pops://<mailAccount>:<password>@<mail.server.com>
into

Code: Select all

         // create SSL this Way  
	 cUrl := 'pops://' + cServers + ':' + cPort
         * Create Connection
         oUrl := tUrl():New( cUrl )
         * Try Connect
         BEGIN SEQUENCE
            oPopServer := TIpClientPop():new( oUrl , lTrace )
         RECOVER
            MsgInfo('can not create the connection, try again ' , 'Attention message' )
            Return
         END
         // now assign User / PW  
         oPopServer:oUrl:cUserID    := cUser
         oPopServer:oUrl:cPassword  := cPassword
         oPopServer:nConnTimeout    := 2500
         IF .NOT. oPopServer:open()
THX for Tip to get c:\hmg.3.4.4\HARBOUR\contrib\hbtip\ working :D