FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour Harbour and xHarbour para MingW GCC1501
Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: Harbour and xHarbour para MingW GCC1501
Posted: Sat May 17, 2025 05:47 PM
Enrico Maria Giordano wrote: Can you show me a MINIMAL yet complete sample using CDOSYS that freezes on run?
I'm already tired. Next week I'll continue the saga. hahahaha.

Ya estoy cansado La semana que viene continuaré la saga. jajajaja,.

Gracias, tks.

Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Harbour and xHarbour para MingW GCC1501
Posted: Sat May 17, 2025 10:05 PM
This is working fine with all the compilers combinations (please fill it with your email data):
#include "Fivewin.ch"


FUNCTION MAIN()

    LOCAL cFrom         := ""
    LOCAL cServer       := ""
    LOCAL cTo           := ""
    LOCAL cSubject      := ""
    LOCAL cMessage      := ""
    LOCAL aAttach       := NIL
    LOCAL cSender       := NIL
    LOCAL cUser         := ""
    LOCAL cPassword     := ""
    LOCAL aCC           := NIL
    LOCAL lHtml         := NIL
    LOCAL cPort         := NIL
    LOCAL lNotification := NIL
    LOCAL lSSL          := NIL

    ? SENDMAIL( cFrom, cServer, cTo, cSubject, cMessage, aAttach, cSender, cUser, cPassword, aCc, lHtml, cPort, lNotification, lSSL )

    RETURN NIL


#command IF <condition> THEN <*statements*> => if <condition> ; <statements> ; end


FUNCTION SENDMAIL( cFrom, cServer, cTo, cSubject, cMessage, aAttach, cSender, cUser, cPassword, aCc, lHtml, cPort, lNotification, lSSL )

    LOCAL lOk := .F.

    LOCAL oCfg, oMsg

    LOCAL cCc := ""

    LOCAL i

    DEFAULT lHtml         := "<html" $ LOWER( cMessage )
    DEFAULT lNotification := .F.
    DEFAULT lSSL          := .F.

    TRY
        oCfg = CREATEOBJECT( "CDO.Configuration" )

        oCfg:Fields( "http://schemas.microsoft.com/cdo/configuration/smtpserver" ):Value = cServer

        IF !EMPTY( cPort )
            oCfg:Fields( "http://schemas.microsoft.com/cdo/configuration/smtpserverport" ):Value = VAL( cPort )
        ENDIF

        oCfg:Fields( "http://schemas.microsoft.com/cdo/configuration/sendusing" ):Value = 2
        oCfg:Fields( "http://schemas.microsoft.com/cdo/configuration/smtpauthenticate" ):Value = .F.

        IF !EMPTY( cUser ) .AND. !EMPTY( cPassword )
            oCfg:Fields( "http://schemas.microsoft.com/cdo/configuration/smtpauthenticate" ):Value = .T.
            oCfg:Fields( "http://schemas.microsoft.com/cdo/configuration/sendusername" ):Value = cUser
            oCfg:Fields( "http://schemas.microsoft.com/cdo/configuration/sendpassword" ):Value = cPassword
            oCfg:Fields( "http://schemas.microsoft.com/cdo/configuration/smtpusessl" ):Value = lSSL
        ENDIF

        oCfg:Fields:Update()

        oMsg = CREATEOBJECT( "CDO.Message" )

        oMsg:Configuration = oCfg

        IF !EMPTY( cSender ) THEN cFrom = ["] + cSender + ["] + " <" + cFrom + ">"

        oMsg:From    = cFrom
        oMsg:To      = cTo
        oMsg:Subject = cSubject

        IF !EMPTY( aCc )
            FOR i = 1 TO LEN( aCc )
                IF i > 1 THEN cCc += ";"
                cCc += aCc[ i ]
            NEXT

            oMsg:CC = cCc
        ENDIF

        IF !lHtml
            oMsg:TextBody = cMessage
        ELSE
            oMsg:HTMLBody = cMessage
        ENDIF

        IF !EMPTY( aAttach )
            FOR i = 1 TO LEN( aAttach )
                oMsg:AddAttachment( aAttach[ i ] )
            NEXT
        ENDIF

        IF lNotification
            oMsg:Fields( "urn:schemas:mailheader:disposition-notification-to" ):Value = cFrom
            oMsg:Fields:Update()
        ENDIF

        oMsg:Send()

        lOk = .T.
    CATCH
    END

    RETURN lOk
Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: Harbour and xHarbour para MingW GCC1501
Posted: Sun May 18, 2025 02:48 PM
Buenos días Enrico. Con sólo un módulo, funcionará. El problema es cuando se trata de un sistema completo gigantesco. Haré lo siguiente: CREAR LAS PANTALLAS DE ENTRADAS Y GETS y las incorporaré al sistema para ver si se congela usando SENDMAIL también. Muchas gracias por tu ayuda.
******************************************************************************
* Enviando Emails e Anexos Usando SENDMAIL.PRG                    18/05/2025 *
*                                                                            *
* Agradecimentos Para: Enrico Maria Giordano: SENDMAIL.PRG                   *
*                                                                            *
* Contato: +55(11) 9.5150-7341                                               *
* Modificado por: Joao Santos                        C:\SENDMAIL - Projeto.  *
* Ultima Atualizacao: 18/05/2025  Por: Joao Santos   Usando: MINGW GCC 15.1  *
******************************************************************************

#Include "Fivewin.ch"

FUNCTION Main()

   LOCAL cFrom         := "joao@pleno.com.br"            // De
   LOCAL cServer       := "smtp.pleno.com.br"            // Servidor
   LOCAL cTo           := "kapiabafwh@gmail.com; e.m.giordano@emagsoftware.it" // Para
   LOCAL cSubject      := "TESTE DE SENDMAIL VIA GCC"    // Assunto
   LOCAL cMessage      := "Enrico Maria Giordano"        // Mensagem
   LOCAL aAttach       := NIL                            // Anexos/adjuntos.
   LOCAL cSender       := "Joao Santos"                  // Remetente/Remitente
   LOCAL cUser         := "pleno@pleno.com.br"           // usuario
   LOCAL cPassword     := "2424242"                      // Senha/contrase¤a
   LOCAL aCC           := NIL // NO FUNCIONAL            // Com Copia
   LOCAL lHtml         := .F.                            // Html
   LOCAL cPort         := "587" // NIL                   // Porta
   LOCAL lNotification := .F.                            // Notificacao(recebeu?)
   LOCAL lSSL          := .F.

   ? SENDMAIL( cFrom, cServer, cTo, cSubject, cMessage, aAttach, cSender, ;
               cUser, cPassword, aCc, lHtml, cPort, lNotification, lSSL )

RETURN NIL

#command IF <condition> THEN <*statements*> => if <condition> ; <statements> ; end

FUNCTION SENDMAIL( cFrom, cServer, cTo, cSubject, cMessage, aAttach, cSender, ;
                   cUser, cPassword, aCc, lHtml, cPort, lNotification, lSSL )

   LOCAL lOk := .F., oCfg, oMsg, cCc := "", i

   DEFAULT lHtml         := "<html" $ Lower( cMessage )
   DEFAULT lNotification := .F.
   DEFAULT lSSL          := .F.

   TRY
      oCfg := CREATEOBJECT( "CDO.Configuration" )

      oCfg:Fields( "http://schemas.microsoft.com/cdo/configuration/smtpserver" ):Value = cServer

      IF .NOT. EMPTY( cPort )

         oCfg:Fields( "http://schemas.microsoft.com/cdo/configuration/smtpserverport" ):Value = VAL( cPort )

      ENDIF

      oCfg:Fields( "http://schemas.microsoft.com/cdo/configuration/sendusing" ):Value = 2
      oCfg:Fields( "http://schemas.microsoft.com/cdo/configuration/smtpauthenticate" ):Value = .F.

      IF .NOT. EMPTY( cUser ) .AND. !EMPTY( cPassword )

          oCfg:Fields( "http://schemas.microsoft.com/cdo/configuration/smtpauthenticate" ):Value = .T.
          oCfg:Fields( "http://schemas.microsoft.com/cdo/configuration/sendusername" ):Value = cUser
          oCfg:Fields( "http://schemas.microsoft.com/cdo/configuration/sendpassword" ):Value = cPassword
          oCfg:Fields( "http://schemas.microsoft.com/cdo/configuration/smtpusessl" ):Value = lSSL

      ENDIF

      oCfg:Fields:Update()

      oMsg := CREATEOBJECT( "CDO.Message" )

      oMsg:Configuration := oCfg

      IF .NOT. EMPTY( cSender ) THEN cFrom = ["] + cSender + ["] + " <" + cFrom + ">"

         oMsg:From    := cFrom
         oMsg:To      := cTo
         oMsg:Subject := cSubject

         IF .NOT. EMPTY( aCc )

            FOR i = 1 TO LEN( aCc )

              IF i > 1 THEN cCc += ";"

                 cCc += aCc[ i ]

            NEXT

        oMsg:CC = cCc

     ENDIF

     IF .NOT. lHtml

        oMsg:TextBody := cMessage

      ELSE

         oMsg:HTMLBody := cMessage

      ENDIF

      IF .NOT. EMPTY( aAttach )

         FOR i = 1 TO LEN( aAttach )

            oMsg:AddAttachment( aAttach[ i ] )

         NEXT

      ENDIF

      IF lNotification

         oMsg:Fields( "urn:schemas:mailheader:disposition-notification-to" ):Value = cFrom
         oMsg:Fields:Update()

      ENDIF

      oMsg:Send()

      lOk = .T.

   CATCH

   END

RETURN( lOk )

// FIN / END - ================= kapiabafwh@gmail.com =======================
Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: Harbour and xHarbour para MingW GCC1501
Posted: Mon May 19, 2025 06:07 PM
Empezando a trabajar. Todo está funcionando correctamente, luego lo incorporaré al sistema.

https://imgur.com/mY3zBNJ



Gracias , tks.

Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 670
Joined: Wed Oct 19, 2005 06:41 PM
Re: Harbour and xHarbour para MingW GCC1501
Posted: Tue May 20, 2025 01:22 PM

buenos días

mi experiencia en el sistema si se pone en el mismo exe el envio se hace lento y poco a poco se va quedando hasta que es intrabajable

mi solución escribir un xml en una carpeta común con tags con el contenido del mail

y un programa externo que esta siempre encendido que es quien lee el xml y envía el mail con eso el programa grande queda sin ese lio

solo mi experiencia

saludos

WIlson

Wilson 'W' Gamboa A
Wilson.josenet@gmail.com
Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: Harbour and xHarbour para MingW GCC1501
Posted: Tue May 20, 2025 01:46 PM
Gracias Wilson por el consejo. Probablemente uses HARBOUR (Dios no lo quiera-jajajaja). Yo uso SÓLO XHARBOUR CON BCC77 y el sistema funciona de maravilla, el cliente puede enviar hasta 500 emails (recomendado) a la vez sin ningún problema. Ahora, cuando COMPILO EL MISMO SISTEMA con MINGW GCC 15.1, el sistema se CONGELA.

https://imgur.com/XLOlwB3



Gracias, tks.

Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Harbour and xHarbour para MingW GCC1501
Posted: Tue May 20, 2025 05:29 PM

Can you try to extract some code to reproduce the problem?

Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: Harbour and xHarbour para MingW GCC1501
Posted: Tue May 20, 2025 06:09 PM
Enrico Maria Giordano wrote: Can you try to extract some code to reproduce the problem?
Good afternoon Enrico. Unfortunately, I can't do it for now, because this system is commercial and belongs to the company I work for. When I finish incorporating SENDMAIL.PRG into the project and testing and freezing it, if I have some time left, I will try to reproduce the freezing with a DEMO that uses CDOSYS that I distribute to all Fivewin users. It will take a while. Please be patient.

Buenas tardes Enrico. Lamentablemente por ahora no puedo, ya que este sistema es comercial y pertenece a la empresa en la que trabajo. Cuando termine de incorporar SENDMAIL.PRG al proyecto y de probar y congelar también, con algo de tiempo restante, intentaré reproducir el congelamiento con una DEMO que usa CDOSYS que distribuyo a todos los usuarios de Fivewin. Tomará un poco de tiempo. Pido un poco de paciencia.

Gracias, tks

Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: Harbour and xHarbour para MingW GCC1501
Posted: Wed May 21, 2025 07:11 PM
Buenas tardes Enrico. Vea lo que sucede cuando incluyo un BITMAP en el DIÁLOGO. Inexplicable. ¿Sabes la razón?

Good afternoon Enrico. See what happens when I include a BITMAP in DIALOG. Inexplicable. Do you know why?
hbmk2: Processing environment options: -comp=mingw
hbmk2: Compiling Harbour sources...
Harbour 3.2.0dev (r2503251254)
Copyright (c) 1999-2024, https://harbour.github.io/
hbmk2: Compiling resources...
windres.exe: dialog control end: not enough binary data
hbmk2[Proj]: Error: Running resource compiler. 1
windres.exe -IC:/HBGCC151/include -IC:/HBGCC151/contrib/hbwin -IC:/HBGCC151/contrib/hbct -IC:/HBGCC151/contrib/xhb -IC:/HBGCC151/contrib/hbtip -IC:/HBGCC151/contrib/hbfship -IC:/HBGCC151/contrib/hbxpp -IC:/HBGCC151/contrib/hbmzip -IC:/HBGCC151/contrib/hbcomm -IC:/HBGCC151/contrib/hbcurl C:/SENDMAIL/ACBRREAL.res -O coff -o C:/SENDMAIL/ACBRREAL.reso
Gracias, tks.

Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Harbour and xHarbour para MingW GCC1501
Posted: Wed May 21, 2025 07:26 PM

I need a reduced sample, similar to the one I've already shown here.

Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: Harbour and xHarbour para MingW GCC1501
Posted: Wed May 21, 2025 07:48 PM
Enrico Maria Giordano wrote: I need a reduced sample, similar to the one I've already shown here.
I found out: the problem is the lack of <WINDOWS.H> how do I tell Workshop.exe to get it? It doesn't recognize <WINDOWS.H"> when I incorporate it into the .rc file.

Descubrí: el problema es la falta de <WINDOWS.H> ¿cómo le digo a Workshop.exe que lo obtenga? No reconoce <WINDOWS.H"> cuando lo inserto en el archivo .rc.

Gracias, tks.

Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Harbour and xHarbour para MingW GCC1501
Posted: Wed May 21, 2025 09:25 PM

Add --preprocessor "gcc -E -xc-header -include windows.h" to windres.exe command.

Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: Harbour and xHarbour para MingW GCC1501
Posted: Wed May 21, 2025 11:00 PM
Enrico Maria Giordano wrote: Add --preprocessor "gcc -E -xc-header -include windows.h" to windres.exe command.
Enrico, se es asi, no funciona.
#flags

#-inc
-rebuild
-a
-m
-n
-w1
-es0
-gc1
-q
-v
-p
-gui
-map
--preprocessor "gcc -E -xc-header -include windows.h"
-o${OuputExe}\${ExeName}
-workdir=C:\SENDMAIL\

#-run
Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Harbour and xHarbour para MingW GCC1501
Posted: Thu May 22, 2025 07:28 AM

I tried here yesterday and worked fine.

Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: Harbour and xHarbour para MingW GCC1501
Posted: Thu May 22, 2025 10:15 AM
Enrico Maria Giordano wrote: I tried here yesterday and worked fine.
Esto no funciona aquí Enrico. ¿Puedes enviarme por correo electrónico tus *.BAT y *.HBP para que pueda compararlos con los míos? O si es posible publícalo aquí.

It doesn't work here Enrico. Can you please send me your *.BAT and your *.HBP via email so I can compare them with mine? Or if possible, post them here.
hbmk2: Processing environment options: -comp=mingw
hbmk2: Compiling Harbour sources...
Error F0035  Bad command-line parameter '--preprocessor'
hbmk2[Proj]: Error: Running Harbour compiler (built-in). 1
(C:\HBGCC151\bin\win\mingw\harbour.exe) -n2 C:\SENDMAIL\gcc -E -xc-header -include windows.h C:\SENDMAIL\SENDMAIL.prg -a -m -n -w1 -es0 -gc1 -q -v -p --preprocessor -DHBMK_HAS_HBWIN=1 -DHBMK_HAS_HBCT=1 -DHBMK_HAS_HBTIP=1 -DHBMK_HAS_HBFSHIP=1 -DHBMK_HAS_HBXPP=1 -DHBMK_HAS_XHB=1 -DHBMK_HAS_MINIZIP=1 -DHBMK_HAS_HBMZIP=1 -DHBMK_HAS_HBZIPARC=1 -DHBMK_HAS_HBCOMM=1 -DHBMK_HAS_HBCURL=1 -oC:\SENDMAIL\ -iC:\HBGCC151\include -iC:\HBGCC151\contrib\hbwin -iC:\HBGCC151\contrib\hbct -iC:\HBGCC151\contrib\xhb -iC:\HBGCC151

\contrib\hbtip -iC:\HBGCC151\contrib\hbfship -iC:\HBGCC151\contrib\hbxpp -iC:\HBGCC151\contrib\hbmzip -iC:\HBGCC151\contrib\hbcomm -iC:\HBGCC151\contrib\hbcurl -u+C:\HBGCC151\contrib\hbwin\hbwin.ch -u+C:\HBGCC151\contrib\hbmzip\hbmzip.ch -u+C:\HBGCC151\contrib\hbcurl\hbcurl.ch
Gracias, tks.

Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341