FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour New Fivewin with new PDF
Posts: 408
Joined: Sun Nov 06, 2005 03:55 PM
New Fivewin with new PDF
Posted: Sat Apr 02, 2022 08:29 AM

I am testing the new Fivewin 21.11 and have been creating PDF's with the FwPdf class and it works great. Does anybody know how to be sure when the FwPdf class releases the file, or can you make sure it has released the file before moving on in the program. I am immediately needing to email the file as an attachment and need to make sure it is available before I attempt to send the email?

Thanks,

Thanks,

Byron Hopp

Matrix Computer Services
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: New Fivewin with new PDF
Posted: Sat Apr 02, 2022 10:45 AM
Code (fw): Select all Collapse
if File( "myfile.pdf" )
  ...
Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo

El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
Posts: 1772
Joined: Thu Sep 05, 2019 05:32 AM
Re: New Fivewin with new PDF
Posted: Sat Apr 02, 2022 08:43 PM
hi,

Code (fw): Select all Collapse
if File( "myfile.pdf" ) .AND. FilesSire > 0

as long PDF is "not finish" Size is 0
i do have same Problem when create "ZIP" Files which work "asynchron"
greeting,

Jimmy
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: New Fivewin with new PDF
Posted: Sat Apr 02, 2022 09:53 PM
Jimmy, yes, very good your post
Code (fw): Select all Collapse
if File( "myfile.pdf" ) .and hb_fsize( "myfile.pdf" ) > 0   // 10
...
Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo

El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
Posts: 408
Joined: Sun Nov 06, 2005 03:55 PM
Re: New Fivewin with new PDF
Posted: Mon Apr 04, 2022 05:30 PM

All, thanks for the responses but I was hoping I could find a way to determine that the file is created and the file handle has been released with out testing for it. I have been working with PDF995 and the reason I moved to using the new fivewin was with the hope that I would not have to test for the existence of the file, test for size (and what I found out is that just not equal to zero will not work, the file may read several sizes before it is complete). Is there a way for the program to stop on the line where it is writing the file to the disc, and not move on until it is complete. Where I can be sure the file is there, complete, and released. Thanks,

Thanks,

Byron Hopp

Matrix Computer Services
Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: New Fivewin with new PDF
Posted: Mon Apr 04, 2022 06:55 PM
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: New Fivewin with new PDF
Posted: Mon Apr 04, 2022 08:06 PM

Dear Byron,

You could try to rename the PDF file, as meanwhile the file is in use, you will not able to do it:

while FRename( cCurrentName, cNewName ) != 0
SysWait()
end

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 408
Joined: Sun Nov 06, 2005 03:55 PM
Re: New Fivewin with new PDF
Posted: Mon Apr 04, 2022 11:23 PM

This problem may be related to the new programming environment for my new FWHarbour libs. Is it possible that if I don't have the libs in the correct order I could have problems. I am getting the following message:

Could not send message;Error: 1;SubC: 1006;OSCode: -2147352573;SubSystem: WINOLE;Message: Argument error

This seems to happen right when I attempt to attach the file using the oEmailMsg:AddAttachment method.
If I don't include an attachment the email sends fine. Is there a way to get better information on the Argument error to help debug?

Thanks,

Thanks,

Byron Hopp

Matrix Computer Services
Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: New Fivewin with new PDF
Posted: Tue Apr 05, 2022 10:21 AM
Good Morning,

oEmailMsg:AddAttachment method


Show your email sending routine please.

test it too, with my email sending routine: RMAIL.PRG

Download Complete,

https://mega.nz/file/FQFWgIDT#kvRtIHIesRpTw9I8CxJenTRikG4VXM0t_7J8qVQsOX8

Use google translator to change from Portuguese to English, please.

Questions, feel free to ask.

Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 408
Joined: Sun Nov 06, 2005 03:55 PM
Re: New Fivewin with new PDF
Posted: Tue Apr 05, 2022 07:12 PM

Here is the code for email. Seems to work in xHB using FiveWin 7.01, but it doesn't work with the new FiveWin which makes me think I have something wrong with my make file.

include "FiveWin.ch"

DEFINE TRUE .T.

DEFINE FALSE .F.

function Main()

TestSend()

return nil

Function TestSend()
Local cServer := "smtp.gmail.com"
Local cUserName := "Shipping@mycompany.com"
Local cPassWord := "mypassword"
Local cFrom := "Shipping@mycompany.com"
Local cSubject := DtoC( Date() ) + "-" + Time() + ", SPF Test for EMail"
Local cToAddr := "byron.hopp@gmail.com"
Local cCC := "bhopp@matrixcomputer.com"
Local cBody := "Email to test the SPF information in the EML. This email was authencated using the Shipping@mycompany.com user name."
Local cAttach := "c:\PdfFolder\Hopp.pdf"
Local cCsvFile := ""
Local lAttachCsv := FALSE
Local cLogFile := ""
McsSendEMail( cServer,cUserName,cPassWord,cFrom,cSubject,cToAddr,cCC,cBody,cAttach,cCsvFile,lAttachCsv,cLogFile )
Return nil

Function McsSendEMail( cServer,cUserName,cPassWord,cFrom,cSubject,cToAddr,cCC,cBody,cAttach,cCsvFile,lAttachCsv,cLogFile )
Local oError := nil
Local nI := 0
Local oEmailCfg := nil
Local oEmailMsg := nil
Local cHtml := '<!DOCTYPE HTML PUBLIC "-/' + '/W3C/' + '/DTD HTML 4.0 Transitional/' + '/EN">'
cHtml += '<HTML><HEAD>'
cHtml += '<META content="text/html; charset=iso-8859-1" http-equiv=Content-Type>'
cHtml += '<META name=GENERATOR content="MSHTML 8.00.6001.18783">'
cHtml += '<STYLE></STYLE>'
cHtml += '</HEAD>'
cHtml += '<BODY bgColor=#ffffff>'
cHtml += '<DIV><FONT size=2 face=Courier New>' + cBody + '</FONT></DIV></BODY></HTML>'

Try
   oEmailCfg := CreateObject(&quot;CDO.Configuration&quot;)
    oEmailCfg:Fields:Item( &quot;http:&quot; + &quot;/&quot; + &quot;/&quot; + &quot;schemas.microsoft.com/cdo/configuration/smtpserver&quot;            ):Value := cServer   // &quot;smtp.gmail.com&quot;
    oEmailCfg:Fields:Item( &quot;http:&quot; + &quot;/&quot; + &quot;/&quot; + &quot;schemas.microsoft.com/cdo/configuration/smtpserverport&quot;        ):Value := 465       // was 587
    oEmailCfg:Fields:Item( &quot;http:&quot; + &quot;/&quot; + &quot;/&quot; + &quot;schemas.microsoft.com/cdo/configuration/sendusing&quot;             ):Value := 2         // 1 Pickup, 2 Port, 3 Exchange
    oEmailCfg:Fields:Item( &quot;http:&quot; + &quot;/&quot; + &quot;/&quot; + &quot;schemas.microsoft.com/cdo/configuration/smtpauthenticate&quot;      ):Value := TRUE
    oEmailCfg:Fields:Item( &quot;http:&quot; + &quot;/&quot; + &quot;/&quot; + &quot;schemas.microsoft.com/cdo/configuration/smtpusessl&quot;            ):Value := TRUE      // FALSE
    oEmailCfg:Fields:Item( &quot;http:&quot; + &quot;/&quot; + &quot;/&quot; + &quot;schemas.microsoft.com/cdo/configuration/sendusername&quot;          ):Value := cUserName
    oEmailCfg:Fields:Item( &quot;http:&quot; + &quot;/&quot; + &quot;/&quot; + &quot;schemas.microsoft.com/cdo/configuration/sendpassword&quot;          ):Value := cPassWord
    oEmailCfg:Fields:Item( &quot;http:&quot; + &quot;/&quot; + &quot;/&quot; + &quot;schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout&quot; ):Value := 10

    oEmailCfg:Fields:Update()
Catch oError
     MsgStop( oError:Description,&quot;CDO.Configuration - cEMailCfg:Fields:Update()&quot;)
End Try
Try
    oEmailMsg := CreateObject(&quot;CDO.Message&quot;)
    oEmailMsg:Configuration := oEmailCfg
    oEmailMsg:From          := cFrom   // chr(34) + &quot;shipping@mycompany.com&quot; + chr(34) + &quot;&lt;shipping@mycompany.com&gt;&quot;
    oEmailMsg:To            := cToAddr // &quot;bhopp@matrixcomputer.com&quot;
    oEmailMsg:Cc            := &quot;&quot;
    oEmailMsg:BCc           := &quot;&quot;
    oEmailMsg:Subject       := cSubject
    oEmailMsg:MDNRequested  := FALSE
    oEmailMsg:HTMLBody      := cBody

    If File( cAttach )
       oEmailMsg:AddAttachment := cAttach
    Endif

    If lAttachCsv .AND. File( cCsvFile )
       oEmailMsg:AddAttachment := cCsvFile
    Endif

    oEmailMsg:Send()
Catch oError
     MsgInfo( &quot;Could not send message&quot; + &quot;;&quot;  + ;
            &quot;Error: &quot;     + TRANSFORM(oError:GenCode,   NIL) + &quot;;&quot; + ;
            &quot;SubC: &quot;      + TRANSFORM(oError:SubCode,   NIL) + &quot;;&quot; + ;
            &quot;OSCode: &quot;    + TRANSFORM(oError:OsCode,    NIL) + &quot;;&quot; + ;
            &quot;SubSystem: &quot; + TRANSFORM(oError:SubSystem, NIL) + &quot;;&quot; + ;
            &quot;Message: &quot;   + oError:Description )
End Try

Return nil

Thanks,

Byron Hopp

Matrix Computer Services
Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: New Fivewin with new PDF
Posted: Tue Apr 05, 2022 07:20 PM
Byron, test your modified example now.

Code (fw): Select all Collapse
// ** Test program for email *** version by <!-- e --><a href="mailto:kapiabafwh@gmail.com">kapiabafwh@gmail.com</a><!-- e -->

#include "FiveWin.ch"

FUNCTION Main()

   TestSend()

RETURN NIL

FUNCTION TestSend()

   /*
   LOCAL cServer := "smtp.gmail.com"
   LOCAL cUserName := "Shipping@mycompany.com"
   LOCAL cPassWord := "MyPassword"
   LOCAL cFrom := "Shipping@mycompany.com"
   LOCAL cSubject := DToC( Date() ) + "-" + Time() + ", Test for EMail"
   LOCAL cToAddr := "byron.hopp@gmail.com"
   LOCAL cCC := "bhopp@matrixcomputer.com"
   LOCAL cBody := "Email to test the SPF information in the EML. This email was authencated using the <!-- e --><a href="mailto:Shipping@mycompany.com">Shipping@mycompany.com</a><!-- e --> user name."
   LOCAL cAttach := "c:\PdfFolder\Hopp.pdf" // any pdf can go here
   LOCAL cCsvFile := ""
   LOCAL lAttachCsv := .F.
   LOCAL cLogFile := ""
   */

   // It worked perfect Byron.
   LOCAL cServer    := "smtp.pleno.com.br"
   LOCAL cUserName  := "joao@pleno.com.br"
   LOCAL cPassWord  := "MyPassword"
   LOCAL cFrom      := "joao@pleno.com.br"
   LOCAL cSubject   := DToC( Date() ) + "-" + Time() + ", Test for EMail"
   LOCAL cToAddr    := "kapiabafwh@gmail.com"
   LOCAL cCC        := "bhopp@matrixcomputer.com"
   LOCAL cBcc       := "joao@pleno.com.br"
   LOCAL cBody      := "Body Byron: Email to test the SPF information in the EML. This email was authencated using the <!-- e --><a href="mailto:Shipping@mycompany.com">Shipping@mycompany.com</a><!-- e --> user name."
// LOCAL cAttach    := "c:\PdfFolder\Hopp.pdf" // any pdf can go here
   LOCAL cAttach    := "C:\ORCAMPDF\INSUMOS.PDF"
   LOCAL cCsvFile   := ""
   LOCAL lAttachCsv := .F.
   LOCAL cLogFile   := ""

   IF .NOT. FILE( cAttach )

      MsgInfo( "Warning: PDF file, not located in source folder.", ;
               "Warning: PDF file, not located in source folder." )

   ENDIF

   McsSendEMail( cServer, cUserName, cPassWord, cFrom, cSubject, cToAddr, cCC, cBcc, cBody, cAttach, cCsvFile, lAttachCsv, cLogFile )

RETURN NIL

FUNCTION McsSendEMail( cServer, cUserName, cPassWord, cFrom, cSubject, cToAddr, cCC, cBcc, cBody, cAttach, cCsvFile, lAttachCsv, cLogFile )

   LOCAL oError, oCfg, oMsg, lRet := .T.
   LOCAL cHtml := '<!DOCTYPE HTML PUBLIC "-/' + '/W3C/' + '/DTD HTML 4.0 Transitional/' + '/EN">'

   cHtml += '<HTML><HEAD>'
   cHtml += '<META content="text/html; charset=iso-8859-1" http-equiv=Content-Type>'
   cHtml += '<META name=GENERATOR content="MSHTML 8.00.6001.18783">'
   cHtml += '<STYLE></STYLE>'
   cHtml += '</HEAD>'
   cHtml += '<BODY bgColor=#ffffff>'
   cHtml += '<DIV><FONT size=2 face=Courier New>' + cBody + '</FONT></DIV></BODY></HTML>'

   /* // ??? Internal ???
   IF Upper( AllTrim( cServer ) ) <> "smtp.gmail.com" .OR. ;
      Upper( AllTrim( cUserName ) ) <> "shipping@frupco.com" .OR. ;
      AllTrim( cPassWord ) <> "sC-93611"

      MsgStop( "Please check the Email Credentials in the INI file, or call MCS.", "McsSendEmail" )

      RETURN NIL

   ENDIF
   */

   Try

      oCfg := CreateObject( "CDO.Configuration" )

      WITH OBJECT oCfg:Fields

         oCfg:Item( "http://schemas.microsoft.com/cdo/configuration/smtpserver"       ):Value := cServer // Servidor SMTP
         oCfg:Item( "http://schemas.microsoft.com/cdo/configuration/smtpserverport"   ):Value := 587     // nPort
         oCfg:Item( "http://schemas.microsoft.com/cdo/configuration/sendusing"        ):Value := 2       // Remote SMTP = 2, local = 1
         oCfg:Item( "http://schemas.microsoft.com/cdo/configuration/smtpauthenticate" ):Value := .T.     // lAut
         oCfg:Item( "http://schemas.microsoft.com/cdo/configuration/smtpusessl"       ):Value := .F.     // lSSL // .F. Ou .T.
         oCfg:Item( "http://schemas.microsoft.com/cdo/configuration/sendusername"     ):Value := TRIM(cUserName)
         oCfg:Item( "http://schemas.microsoft.com/cdo/configuration/sendpassword"     ):Value := TRIM(cPassWord)
         oCfg:Item( "http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout"):Value := 60

         oCfg:Update()

      END WITH

   Catch oError

      MsgStop( oError:Description, "CDO.Configuration - cEMailCfg:Update()" )

   End Try

   Try

      oMsg := CREATEOBJECT ( "CDO.Message" )

      WITH OBJECT oMsg

         oMsg:Configuration := oCfg
         oMsg:FROM          := cFrom // chr(34) + "shipping@mycompany.com" + chr(34) + "<shipping@mycompany.com>"
         oMsg:TO            := cToAddr // "bhopp@matrixcomputer.com"
         oMsg:Cc            := cCC //""
         oMsg:BCc           := cBcc //""
         oMsg:Subject       := cSubject
         oMsg:MDNRequested  := .F.
         oMsg:HTMLBody      := cBody

      IF File( cAttach )

         oMsg:AddAttachment := cAttach

      ENDIF

      IF lAttachCsv .AND. File( cCsvFile )

         oMsg:AddAttachment := cCsvFile

      ENDIF

      :Send()

      END WITH

   Catch oError

      MsgInfo( "Could not send message" + ";" + ;
               "Error: " + Transform( oError:GenCode, NIL ) + ";" + ;
               "SubC: " + Transform( oError:SubCode, NIL ) + ";" + ;
               "OSCode: " + Transform( oError:OsCode, NIL ) + ";" + ;
               "SubSystem: " + Transform( oError:SubSystem, NIL ) + ";" + ;
               "Message: " + oError:Description )

      lRet := .F.

   End Try

   IF lRet

     MsgInfo( "Message sent successfully. Congratulations.", ;
              "Message sent successfully. Congratulations."  )


   ENDIF

   oCfg := Nil
   oMsg := Nil

RETURN NIL

// fin / end - 05/04/2022 - <!-- e --><a href="mailto:kapiabafwh@gmail.com">kapiabafwh@gmail.com</a><!-- e --> - Covid-19


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: New Fivewin with new PDF
Posted: Tue Apr 05, 2022 07:30 PM

Byron, don't forget that starting in May, gmail.com will be disabled for less secure APPs.

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: New Fivewin with new PDF
Posted: Wed Apr 06, 2022 11:44 AM
Code (fw): Select all Collapse
// \samples\BYRON.PRG  using gmail.com -> worked perfect

// ** Test program for email *** version by <!-- e --><a href="mailto:kapiabafwh@gmail.com">kapiabafwh@gmail.com</a><!-- e -->

#include "FiveWin.ch"

FUNCTION Main()

   SET CENTURY ON
   SET DATE BRITISH

   TestSend()

RETURN NIL

FUNCTION TestSend()

   /*
   LOCAL cServer := "smtp.gmail.com"
   LOCAL cUserName := "Shipping@mycompany.com"
   LOCAL cPassWord := "MyPassword"
   LOCAL cFrom := "Shipping@mycompany.com"
   LOCAL cSubject := DToC( Date() ) + "-" + Time() + ", Test for EMail"
   LOCAL cToAddr := "byron.hopp@gmail.com"
   LOCAL cCC := "bhopp@matrixcomputer.com"
   LOCAL cBody := "Email to test the SPF information in the EML. This email was authencated using the <!-- e --><a href="mailto:Shipping@mycompany.com">Shipping@mycompany.com</a><!-- e --> user name."
   LOCAL cAttach := "c:\PdfFolder\Hopp.pdf" // any pdf can go here
   LOCAL cCsvFile := ""
   LOCAL lAttachCsv := .F.
   LOCAL cLogFile := ""
   */

   // It worked perfect Byron. Using: gmail.com
                                   // nPort:   SSL
   //  {"@gmail.com", "smtp.gmail.com", 465,   .T. },;
   LOCAL cServer    := "smtp.gmail.com"
   LOCAL cUserName  := "kapiabafwh@gmail.com"
   LOCAL cPassWord  := "mylongpassword"
   LOCAL cFrom      := "kapiabafwh@gmail.com"
   LOCAL cSubject   := DToC( Date() ) + "-" + Time() + ", Test for EMail"
   LOCAL cToAddr    := "kapiabafwh@gmail.com"
   LOCAL cCC        := "bhopp@matrixcomputer.com"
   LOCAL cBcc       := "joao@pleno.com.br"
   LOCAL cBody      := "Byron Using GMAIL.COM: Email to test the SPF information in the EML. This email was authencated using the <!-- e --><a href="mailto:Shipping@mycompany.com">Shipping@mycompany.com</a><!-- e --> user name."
// LOCAL cAttach    := "c:\PdfFolder\Hopp.pdf" // any pdf can go here
   LOCAL cAttach    := "C:\ORCAMPDF\INSUMOS.PDF"
   LOCAL cCsvFile   := ""
   LOCAL lAttachCsv := .F.
   LOCAL cLogFile   := ""

   IF .NOT. FILE( cAttach )

      MsgInfo( "Warning: PDF file, not located in source folder.", ;
               "Warning: PDF file, not located in source folder." )

   ENDIF



   McsSendEMail( cServer, cUserName, cPassWord, cFrom, cSubject, cToAddr, cCC, cBcc, cBody, cAttach, cCsvFile, lAttachCsv, cLogFile )

RETURN NIL

FUNCTION McsSendEMail( cServer, cUserName, cPassWord, cFrom, cSubject, cToAddr, cCC, cBcc, cBody, cAttach, cCsvFile, lAttachCsv, cLogFile )

   LOCAL oError, oCfg, oMsg, lRet := .T.
   LOCAL cHtml := '<!DOCTYPE HTML PUBLIC "-/' + '/W3C/' + '/DTD HTML 4.0 Transitional/' + '/EN">'

   cHtml += '<HTML><HEAD>'
   cHtml += '<META content="text/html; charset=iso-8859-1" http-equiv=Content-Type>'
   cHtml += '<META name=GENERATOR content="MSHTML 8.00.6001.18783">'
   cHtml += '<STYLE></STYLE>'
   cHtml += '</HEAD>'
   cHtml += '<BODY bgColor=#ffffff>'
   cHtml += '<DIV><FONT size=2 face=Courier New>' + cBody + '</FONT></DIV></BODY></HTML>'

   /* // ??? Internal ???
   IF Upper( AllTrim( cServer ) ) <> "smtp.gmail.com" .OR. ;
      Upper( AllTrim( cUserName ) ) <> "shipping@frupco.com" .OR. ;
      AllTrim( cPassWord ) <> "sC-93611"

      MsgStop( "Please check the Email Credentials in the INI file, or call MCS.", "McsSendEmail" )

      RETURN NIL

   ENDIF
   */

   Try

      oCfg := CreateObject( "CDO.Configuration" )

      WITH OBJECT oCfg:Fields

         oCfg:Item( "http://schemas.microsoft.com/cdo/configuration/smtpserver"       ):Value := cServer // Servidor SMTP
         oCfg:Item( "http://schemas.microsoft.com/cdo/configuration/smtpserverport"   ):Value := 465 //<-(gmail)   587     // nPort
         oCfg:Item( "http://schemas.microsoft.com/cdo/configuration/sendusing"        ):Value := 2       // Remote SMTP = 2, local = 1
         oCfg:Item( "http://schemas.microsoft.com/cdo/configuration/smtpauthenticate" ):Value := .T.     // lAut
         oCfg:Item( "http://schemas.microsoft.com/cdo/configuration/smtpusessl"       ):Value := .T.     // lSSL // .F. Ou .T.(gmail)
         oCfg:Item( "http://schemas.microsoft.com/cdo/configuration/sendusername"     ):Value := TRIM(cUserName)
         oCfg:Item( "http://schemas.microsoft.com/cdo/configuration/sendpassword"     ):Value := TRIM(cPassWord)
         oCfg:Item( "http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout"):Value := 60

         oCfg:Update()

      END WITH

   Catch oError

      MsgStop( oError:Description, "CDO.Configuration - cEMailCfg:Update()" )

   End Try

   Try

      oMsg := CREATEOBJECT ( "CDO.Message" )

      WITH OBJECT oMsg

         oMsg:Configuration := oCfg
         oMsg:FROM          := cFrom // chr(34) + "shipping@mycompany.com" + chr(34) + "<shipping@mycompany.com>"
         oMsg:TO            := cToAddr // "bhopp@matrixcomputer.com"
         oMsg:Cc            := cCC //""
         oMsg:BCc           := cBcc //""
         oMsg:Subject       := cSubject
         oMsg:MDNRequested  := .F.
         oMsg:HTMLBody      := cBody

      IF File( cAttach )

         oMsg:AddAttachment := cAttach

      ENDIF

      IF lAttachCsv .AND. File( cCsvFile )

         oMsg:AddAttachment := cCsvFile

      ENDIF

      :Send()

      END WITH

   Catch oError

      MsgInfo( "Could not send message" + ";" + ;
               "Error: " + Transform( oError:GenCode, NIL ) + ";" + ;
               "SubC: " + Transform( oError:SubCode, NIL ) + ";" + ;
               "OSCode: " + Transform( oError:OsCode, NIL ) + ";" + ;
               "SubSystem: " + Transform( oError:SubSystem, NIL ) + ";" + ;
               "Message: " + oError:Description )

      lRet := .F.

   End Try

   IF lRet

     MsgInfo( "Message sent successfully. Congratulations.", ;
              "Message sent successfully. Congratulations."  )


   ENDIF

   oCfg := Nil
   oMsg := Nil

RETURN NIL

// fin / end - 06/04/2022 - kapiabfwhgmail.com - Covid-19


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

Continue the discussion