Verified Software Products Company
792 Phillips Road || Arroyo Grande, CA 93420-5019 || Phone: (805) 489-5309
Email: bkandler@verisof.com
SERVICES FREEBIES TIPS and TRICKS ARTICLES LINKS HOME
Our Products

Classes
BMPBMP
CryptoCrypto
CSVStringsCSVStrings
DataLoggerDataLogger
DatesDates
DebugRecorderDebugRecorder
FileNameSetFileNameSet
FileSenderFileSender
RDOConnectMasterRDOConnectMaster
ReportAidsReportAids
ShellerSheller
StringSetStringSet
WEBUtilitiesWEBUtilities

Modules
DAOLibDAOLib
GlobalsGlobals
RegistryRegistry

Programs
BatcherBatcher
HTMLGenHTMLGen
KillTimeKillTime
TimedMessageTimedMessage
FileSender: This class arose out of a need to be able to send and receive files via several different methods. Files may be sent/received via Banyan network, cc:Mail, Windows network, Exchange(MAPI), FTP, or FTTSO(IBM mainframe). This means you can utilize any of these six common methods from a single class/dll. A method is also provided to drive PKZip.

We've packaged up the functionality into a single send procedure and a single receive procedure for each of the six methods. So now it takes just 3 lines to send or receive one or more files to/from almost any kind of destination.

Each transport method is supported by its own section in an INI file whose name and location are defaulted to the name and location of the using application or provided via a call to SetupINI before attempting to do a send/receive/delete operation. Calling sequence parameters are setup so that you can either hard-code values or get them from the INI file. This means you can easily build applications that can be configured without recompiling.

Requires CSVStrings class (download from our Freebies page), Sheller class, SETDRIVE.COM (Banyan network), IMPORT.EXE/EXPORT.EXE (cc:Mail), FTTSO.EXE (IBM mainframe), and Microsoft Scripting Runtime(SCRRUN.dll). To see sample use of FileSender and its full interface definition, scroll down.
Download me at once!

This code snippet performs two simple functions. First it sends out an eMail using the MAPI method and then it deletes all .txt files as specified in the [DOS] section of the program's .INI file. This just scratches the surface. Look at the interface definition below to get the full picture of what is included in this Class.
Dim snd As FileSender
  Set snd = New FileSender
  Call snd.SetupIni(ThePath, IniFileName)
  Call snd.MAPISend("ETCMaster@corp.com", _
                    "ETC Login Failure Limit Reached", _
                    "ETC access for the following individual has " + _
                    "been suspended due to too many unsuccessful " + _
                    "login attempts. " + Access.EmpId)
  Set snd = Nothing
  
 'Delete all .txt files from .INI specified server and directory
  Call snd.DOSDelete("*.txt", "", "") As Long 

This is a sample set of .INI file entries for the various file transport mechanisms supported by the FileSender Class. Note how the [DOS] function set may operate either on mapped drives or via a direct server reference using the ServerFilePath (e.g. \\server_name\path) entry.
[Banyan]
SetDrive=z:\SetDrive.com
ServerName=FSUSERS@CIS1@CRP
FilePath=CIS1\ALL\FAIS\PROD\PAYROLL\ETC\

[DOS]
DOSFilePath=W:\FAIS\PROD\PAYROLL\ETC\
ServerFilePath=
PCDirectory=

[ccMail]
ImportProgram=c:\lbwans\ccmail\IMPORT.EXE
ExportProgram=c:\lbwans\ccmail\EXPORT.EXE
PostOffice=LCOR-TOR
MailDirectory=m:\ccdata
UserName=FaisUser
UserPassword=FaisUser2
MailOptions=NAME/1
FileFilter=
PCDirectory=
[FTP]
ServerName=koala.corp.logicon.com
ServerFilePath=
UserName=
UserPassword=
PCDirectory=
RECFM01=

[FTTSO]
DCAProgram=c:\lbwans\dcs\fttso.exe
HostDirectoryName=CORP.EX.
HostName=faisfofs.sn000003
RECFM=
PCDirectory=

[MAPI]
ProfileName=MS Exchange Settings
FileFilter=*.*
PCDirectory=C:\VB5\TCMDOWN\

The following is the complete interface definition for the FileSender Class
Public Function BanyanDelete(FileList As String, Srvr, Pth As String) _
                             As Long 
  ' Delete a set of files in path Pth on server Srvr
  ' FileList is a CSV string of file names
  ' Srvr is the name of the server. Use "" to select the .ini file 
  '   value, ServerName. 
  ' Use Null to use no server name; implies local drop
  ' Pth  is the path on the server. Use "" to select the .ini file 
  '   value, ServerFilePath. 
  'Do not use a drive letter if Srvr <> Null
Public Function BanyanReceive(SrcePath As String, FileList As String, _
                              Srvr, Pth As String) As Long 
  ' Receive a set of files from Pth on server Srvr
  ' SourcePath is the local storage path for the files in FileList
  ' FileList is a CSV string of file names
  ' Srvr is the name of the server. Use "" to select the .ini file 
  '   value, ServerName. 
  ' Use Null to use no server name; implies local drop
  ' Pth  is the path on the server. Use "" to select the .ini file 
  '   value, ServerFilePath. 
  ' Do not use a drive letter if Srvr <> Null
Public Function BanyanSend(SrcePath As String, FileList As String, _
                           Srvr, Pth As String) As Long 
  ' Send a set of files to Pth on server Srvr
  ' SourcePath is the local source path for the files in FileList
  ' FileList is a CSV string of file names
  ' Srvr is the name of the server. Use "" to select the .ini file 
  '   value, ServerName. 
  ' Use Null to use no server name; implies local drop
  ' Pth  is the path on the server. Use "" to select the .ini file 
  '   value, ServerFilePath. 
  ' Do not use a drive letter if Srvr <> Null
Public Function ccMailReceive(MessageTxt As String) As Long 
  ' Receive cc:Mail messages and place them in MessageTxt
Public Function ccMailSend(AddrList As String, FileList As String, _
                           Subj As String, BodyOrFName As String) _
                           As Long 
  ' Send a cc:Mail message, with attachments, to a list of people
  ' AddrList is a CSV list of valid cc:Mail names.
  ' FileList is a CSV list of file names to attach; 
  '   use "" for no attachments
  ' Subj is the subject of the message
  ' BodyOrFName is the name of file containing message body or the 
  '   message itself
Public Function DOSDelete(FileList As String, Srvr, Pth As String) _
                          As Long 
  ' Delete set of files in Pth via a DOS Del command
  ' FileList is a CSV string of file names
  ' Srvr is driveletter:\ or \\servername\ as desired
  ' Pth  is the path on the server. Use "" to select .ini file 
  '   value, ServerFilePath. 
  ' Srvr+Pth constitutes the full path to the PCDirectory directory
Public Function DOSReceive(SrcePath As String, FileList As String, _
                           Srvr, Pth As String) As Long 
  ' Receive set of files from Pth on server Srvr
  ' SourcePath is the local storage path for the files in FileList
  ' FileList is a CSV string of file names
  ' Srvr is the name of the server. Use "" to select .ini file 
  '   value, ServerName. 
  ' Use Null to use no server name; implies local drop
  ' Pth  is the path on the server. Use "" to select .ini file 
  '   value, ServerFilePath. 
  ' Do not use a drive letter if Srvr <> Null
Public Function DOSSend(SrcePath As String, FileList As String, _
                        Srvr, Pth As String) As Long 
  ' Send set of files to Pth via a DOS copy command
  ' SourcePath is the local source path for the files in FileList
  ' FileList is a CSV string of file names
  ' Srvr is either driveletter:\ or \\servername\ as desired
  ' Pth  is the path on the server. Use "" to select .ini file 
  '   value, ServerFilePath. 
  ' Srvr+Pth constitutes the full path to the destination directory
Public Function EMailReceive(MessageFile As String, _
                             Optional MethodOrder As String = "") _
                             As Long 
  ' Receive available eMail messages and place them where indicated 
  '   by MessageFile. 
  ' MethodOrder determines the order of methods to use.
  ' Methods are ccMail or MAPI
Public Function EMailSend(AddrList As String, FileList As String, _
                          Subj As String, BodyOrFName As String, _
                          Optional MethodOrder As String = "") As Long 
  ' Send an EMail message, with attachments, to a list of people
  ' AddrList is a CSV list of valid recipient names.
  ' FileList is a CSV list of file names to attach; use "" for 
  '   no attachments
  ' Subj is the subject of the message
  ' BodyOrFName is the name of a file containing body of message or 
  '   the message itself
  ' Order is the optional order of sending methods to use.  Methods 
  '   are ccMail or MAPI
Public Property Get Error() As String 
  ' Returns last error. Use clears text.
Public Function FTPDelete(SrvUsr As String, SrvPWD As String, _
                          FileList As String, Srvr, Pth As String) _
                          As Long 
  ' Delete set of files on Pth of FTP server Srvr
  ' FileList is a CSV string of file names
  ' Srvr is the name of the server. Use "" to select .ini file 
  '   value, ServerName. 
  ' Use Null to use no server name; implies local drop
  ' Pth  is the path on the server. Use "" to select .ini file 
  '   value, ServerFilePath. 
  ' Do not use a drive letter if Srvr <> Null
Public Function FTPReceive(Srvr, SrvUsr As String, SrvPWD As String, _
                           HostFile As String, FileName As String) _
                           As Long 
  ' Receive set of files in Pth from FTP server Srvr
  ' FileList is a CSV string of file names
  ' Srvr is the name of the server. Use "" to select .ini file 
  '   value, ServerName. 
  ' Use Null to use no server name; implies local drop
  ' Pth  is the path on the server. Use "" to select .ini file 
  '   value, ServerFilePath. 
  ' Do not use a drive letter if Srvr <> Null
Public Function FTPSend(Srvr, SrvUsr As String, SrvPWD As String, _
                        HostFile As String, FileName As String) _
                        As Long 
  ' Send set of files to Pth on FTP server Srvr
  ' SrvPath is the local source path for the files in FileList
  ' FileList is a CSV string of file names
  ' Srvr is the name of the server. Use "" to select .ini file 
  '   value, ServerName. 
  ' Use Null to use no server name; implies local drop
  ' Pth  is the path on the server. Use "" to select .ini file 
  '   value, ServerFilePath. 
  ' Do not use a drive letter if Srvr <> Null
Public Function FTTSOReceive(SrcePath As String, PCFile As String, _
                             HPth As String, HFile As String, _
                             RF As String) As Long 
  ' Receive file from an IBM host
  ' SourcePath+PCFile is the local source path and file name to send
  ' HPth+HFile is the host directory and file name
  ' HPth, HFile, and RF have .ini file default values.
  ' Use "" to select the .ini file value; Use Null to use no value
  ' The corresponding .ini file names are HostDirectoryName, HostName, 
  ' and RECFM, respectively
Public Function MAPILogon(Optional sProfileName As String = "") As Long 
  ' Performs a session logon for MAPI
Public Function MAPIReceive(FileMask As String) As Long 
  ' Recieves eMail files with names matching FileMask and stores them 
  ' in the path provided within FileMask
Public Function MAPISend(AddrList As String, Subj As String, _
                         Optional BodyOrFName As String = "", _
                         Optional FileList As String = "") As Long 
  ' Performs MAPI eMail send to AddrList with Subj. 
  ' BodyOrFName provides message body or a file name to send. 
  ' FileList provides a CSV list of files to send.
  ' Sends a message to each person in the AddrList. Each message is 
  ' identified by its subject (Subj), may contain a message body 
  ' (BodyOrFName), and may have one or more attached files (FileList). 
  ' If problems are encountered and the .ini file specifies an 
  ' ErrorPOC, that person gets a message indicating the problem, who
  ' addressees were, what addresses might have been faulty, and having 
  ' all the attachments that were to be in the original message. If a 
  ' non-zero value is returned, function Error may be used to obtain 
  ' the text describing the error encountered.
Public Sub SetupIni(APath As String, AnIniFile As String) 
  ' Sets MyPath, MyIniFileName
Public Function ZipFile(ZFile As String, File As String) As Long 
  ' compress File into ZFile
Public Function FS_ccMail()             'Returns "ccMail,"
Public Function FS_MAPI()               'Returns "MAPI,"

This site designed by William D. Kandler (bkandler@verisof.com)
Updated: 6/29/01