FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour DEFINE MAIL How many attach files?
Posts: 1091
Joined: Thu Nov 17, 2005 11:08 AM
DEFINE MAIL How many attach files?
Posted: Thu Feb 16, 2017 01:59 PM
Code (fw): Select all Collapse
Hi to all!
How many attach files my I send in a single message?
For My tests I think the limit is 10
Many thanks
Marco
 
FUNCTION SPEDISCITO( cToEle, cFrom, cServer, cSubject, cMessage, cAttEle, cSender, cUser, cPassword )
 LOCAL i
 LOCAL oASpetta
 LOCAL nRes := 0
 LOCAL oMail
 LOCAL aTo  := {}
 LOCAL aFile := {}
 LOCAL nCc

 FOR i := 1 TO mlcount( cToEle , 100 )
     IF i = 1
        nCc := 1
     ELSE
        nCc := 2
     ENDIF
     AADD( aTo , { sepstr( ALLTRIM( memoline(cToEle,100,i) ),";",1) , 2 }  )
 NEXT i

 FOR i := 1 TO mlcount( cAttEle , 100 )
     AADD( aFile , ALLTRIM( memoline( cAttEle , 100 , i )) )
 NEXT i

 IF FILE(ALLTRIM(cMessage))
     cMessage := MEMOREAD(cMessage)
 ENDIF

 DEFINE MAIL oMail        ;
        SUBJECT cSubject  ;
        TEXT cMessage     ;
        FROM USER

 FOR i := 1 TO LEN( aTo )
    AADD( oMail:aRecipients, aTo[i] )
 NEXT i
[b] IF LEN( aFile ) <> 0
    oMail:aFiles := aFile
 ENDIF[/b]

 ACTIVATE MAIL oMail


 RETURN nRes
Marco Boschi
info@marcoboschi.it
Posts: 1091
Joined: Thu Nov 17, 2005 11:08 AM
Re: DEFINE MAIL How many attach files?
Posted: Thu Feb 16, 2017 04:06 PM

Very strange: only 10!
Please...

Marco Boschi
info@marcoboschi.it
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: DEFINE MAIL How many attach files?
Posted: Thu Feb 16, 2017 05:21 PM

Each attachment has to be an array of two items:

AADD( aFile, { "fullpath and filename", "filename only" } )

EMG

Posts: 1091
Joined: Thu Nov 17, 2005 11:08 AM
Re: DEFINE MAIL How many attach files?
Posted: Fri Feb 17, 2017 08:39 AM
Dear Enrico,
Here my modified code
Same problem.

Code (fw): Select all Collapse
#include "fivewin.ch"
#include "mail.ch"

 FUNCTION SPEDISCITO( )
 LOCAL i

 LOCAL oMail
 LOCAL aTo    := {}
 LOCAL aFile2 := {}

AADD( aFile2 , { "n:\hse\stat_onsite.txt"        , "stat_onsite.txt"        } )

...
...
...
 IF LEN( aFile2 ) <> 0
    oMail:aFiles := aFile2
 ENDIF

 ACTIVATE MAIL oMail


 RETURN NIL
Marco Boschi
info@marcoboschi.it
Posts: 117
Joined: Tue Jan 03, 2006 06:18 PM
Re: DEFINE MAIL How many attach files?
Posted: Fri Feb 17, 2017 09:06 AM
Hi MarcoBoschi,

Try

Code (fw): Select all Collapse
#include "fivewin.ch"
#include "mail.ch"

 FUNCTION SPEDISCITO( )
 LOCAL i

 LOCAL oMail
 LOCAL aTo    := {}
 LOCAL aFile2 := {}

if file(xxxxxxxxx)  // before add file, please check it ,if exit or not

      AADD( aFile2 , { "n:\hse\stat_onsite.txt"        , "stat_onsite.txt"        } )

endif

...
...
...
 IF LEN( aFile2 ) <> 0
    oMail:aFiles := aFile2
 ENDIF

 ACTIVATE MAIL oMail


 RETURN NIL



regards,
kok
Posts: 1091
Joined: Thu Nov 17, 2005 11:08 AM
Re: DEFINE MAIL How many attach files?
Posted: Fri Feb 17, 2017 11:24 AM
This little test program asks number of files
Create files
Create Array
and then
define mail .....
The limit is 10!
Unfortunately the limit is 10
Any ideas?

Marco


Code (fw): Select all Collapse
#include "fivewin.ch"
#include "mail.ch"

 FUNCTION SPEDISCITO( )
 LOCAL i

 LOCAL oMail
 LOCAL aTo    := {}
 LOCAL aFiles := {}
 LOCAL aFile  := {}
 LOCAL iFile  := 0
 LOCAL cFile
 LOCAL nFiles := 0

 MsgGet( "How Many files" , "files ", @nFiles )
 FERASE(  "list_of_attach.txt" ) 
 FOR iFile := 1 TO nFiles
     cFile := "file_attach" + ALLTRIM(STR(iFile)) + ".txt"
     AADD( aFile , { curdrive() + ":\" + CurDir() + "\" + cFile , cFile } )
 NEXT

 FOR iFile := 1 TO nFiles
     creafile( aFile[ iFile , 1 ] , "TEXT OF ATTACH FILE" )
 NEXT iFile

 FOR iFile := 1 TO nFiles
     IF FILE( aFile[ iFile , 1 ] )
        AADD( aFiles , { aFile[ iFile , 1 ] , aFile[ iFile , 2 ] } )
     ENDIF
 NEXT iFile

 FOR iFile := 1 TO nFiles
     logfile( "list_of_attach.txt" , { aFiles[ iFile , 1 ] ,  aFiles[ iFile , 2 ] , FILE( aFiles[ iFile , 1 ] ) } )
 NEXT iFile

 AADD( aTo , { "<!-- e --><a href="mailto:info@marcoboschi.it">info@marcoboschi.it</a><!-- e -->" , 1 } )

 DEFINE MAIL oMail         ;
        SUBJECT "TEST"     ;
        TEXT    "TEST"     ;
        FROM USER

 FOR i := 1 TO LEN( aTo )
     AADD( oMail:aRecipients, aTo[ i ] )
 NEXT i

 IF LEN( aFiles ) <> 0
    oMail:aFiles := aFiles
 ENDIF
 ? LEN( oMail:aFiles)
 ACTIVATE MAIL oMail

 RETURN NIL



 FUNCTION Creafile( cFile, cStringa )
  LOCAL nHandle := FCreate( cFile )
  LOCAL cLeggiTest
  LOCAL lRitorna

  IF FError() <> 0
     RETURN .F.
   ENDIF
   FWrite( nHandle, cStringa, Len(cStringa) )
   FClose( nHandle )

   cLeggiTest := MEMOREAD( cFile )

   lRitorna := ( FError() == 0 ) .AND. ( cStringa = cLeggiTest )

 RETURN lRitorna
Marco Boschi
info@marcoboschi.it
Posts: 1091
Joined: Thu Nov 17, 2005 11:08 AM
Re: DEFINE MAIL How many attach files?
Posted: Tue Feb 21, 2017 12:01 PM

only ten files seem so few...isn't it?

:shock:

Marco Boschi
info@marcoboschi.it

Continue the discussion