SMTP/POP3 Email Engine
Library for Visual Basic
Programmer's Manual
(SEE4VB)
Version 3.2
January 17, 2000
This software is provided as-is.
There are no warranties, expressed or implied.
Copyright (C) 2000
All rights reserved
MarshallSoft Computing, Inc.
Post Office Box 4543
Huntsville AL 35815
Voice : 256-881-4630
FAX : 256-880-0925
email : info@marshallsoft.com
web : www.marshallsoft.com
MarshallSoft is a member of the Association of Shareware Professionals
MARSHALLSOFT is a registered trademark of MarshallSoft Computing.
1 Introduction
1.1 Documentation Set2 Compiler Issues
1.2 Example Program
1.3 Installation
1.4 Uninstalling
1.5 Ordering
1.6 Updates
2.1 Visual Basic Makefiles3 Example Programs
2.2 Compiling Programs
2.3 SEE4VB Class
2.4 Dynamic Strings
2.5 Key Code
3.1 SMTP Example Programs4 Revision History
3.2 POP3 Example Programs
SEE4VB is the easiest way to write email applications in Visual Basic !
The SMTP/POP3 Email Engine (SEE) is a library of functions providing direct and simple control of the SMTP (Simple Mail Transport Protocol) and POP3 (Post Office 3) protocols.
A simple interface allows sending and receiving email, including multiple MIME base64 and quoted- printable encoded attachments. Knowledge of Winsock and TCP/IP is not needed.
With SEE4VB, you can write programs that easily:
Ten example programs are included, demonstrating SMTP and POP3 functions. All programs will compile using VB 3.0 through VB 6.0.
Both Win16 and Win32 DLLs (Dynamic Link Libraries) are provided. SEE4VB can be used with Windows 3.X, 95/98, and NT. The SEE4VB DLLs (SEE16.DLL and SEE32.DLL) can also be used from any language (C/C++, Delphi, etc.) capable of calling the Windows API.
When comparing SEE against our competition, note that:
The complete set of documentation consists of three manuals in three formats. This is the first manual
(SEE4VB) in the set.
Each manual comes in three formats:
The following example demonstrates the use of some of the library functions:
Dim Code As Integer Dim Server, IsNull, To, From As String Dim Subject, Message As String IsNull = Chr$(0) Server = "mail.yourisp.com From = "my name<me@myisp.com>" To = "<mike@marshallsoft.com>" Subject = "Visual Basic Test" Message = "Emailed from SEE4VB!" Code = seeAttach(1, SEE_KEY_CODE) If Code < 0 Then ' error calling seeAttach ! . . . End If Code = seeSmtpConnect(Server,From,IsNull) If Code < 0 Then ' error calling seeSmtpConnect ! . . . End If Code = seeSendEmail(To,IsNull,IsNull,Subject,Message,IsNull) If Code < 0 Then ' error calling seeSendEmail ! . . . End If Code = seeClose() Code = seeRelease()
In the example program above, seeAttach is called to initialize SEE and then seeSmtpConnect is called to connect to the SMTP mail host. The SMTP server host name and your email address are required, while the "Reply-To" entry is optional.
seeSendEmail is then called, passing the addressee lists. The primary addressee is provided in the "To List". The CC ("Carbon Copy") lists additional recipients, as does the BCC (Blind Carbon Copy) list. The subject contains the email subject line. The message text is next. If it starts with the '@' symbol, it is considered the name of the file containing the email message. Lastly, the filename of any ASCII or binary attachment is specified. All fields in seeSendEmail are optional except the first.
After returning from seeSendEmail, the seeClose function is called to close the connection to the SMTP server. Lastly, seeRelease is called to perform SEE termination processing and release the Winsock.
SEEVER16.MAK --- Makefile for 16-bit Visual Basic.
SEEVER32.MAK --- Makefile for 32-bit Visual Basic.
Note that the Windows registry is not modified.
Uninstalling SEE4VB is very easy. SEE does not modify the registry.
First, run UINSTALL.BAT, which will delete SEE16.DLL and SEE32.DLL from your Windows directory, typically C:\WINDOWS for Windows 3.1/95/98 or C:\WINNT for Windows NT.
Second, delete the SEE project directory created when installing SEE4VB.
See the section "Ordering" in the SEE User’s Manual (SEE_USR) for details on ordering.
When you register SEE4VB you will receive a set of registered DLLs plus a license file
(SEExxxx.LIC)
that can be used to update your registered DLL’s for a period of one year from purchase.
Updates can be
downloaded from
http://www.marshallsoft.com/oem.htm
After one year, licenses can be updated for $30 for email delivery.
The first Visual Basic for Windows (version 3.0) uses a text file known as a "Visual Basic makefile" (.MAK) to list all the file components necessary to compile a program. Beginning in version 4.0, the "Visual Basic Project file" (.VBP) was added. Both formats are "project files".
In order to allow our example programs to be compiled by all versions of Visual Basic, we use the Visual Basic makefile format. However, after loading, the examples can be saved in whatever format desired.
The example programs can be compiled from the Visual Basic development environment using the provided Visual Basic makefiles. Choose "File", then "Open Project" from the main VB menu.
The example program code is stored in VB 3.0 (WIN16) and VB 4.0 (WIN32) formats. All project files (except StatProj) end in "16.MAK" (e.g.: SEEVER16.MAK) or "32.MAK" (e.g.: SEEVER32.MAK) .
After opening a project, VB 5.0 (and VB 6.0) users can save the project files in the VB 5.0 (or VB 6.0) format. When saving the example programs in VB version 5.0 or VB 6.0 format, answer "no" if asked to add the "Microsoft DAO v2.5 library".
Compile and run SEEVER16 (or SEEVER32) as the first example. SEEVER does not require a TCP/IP connection.
The SEE class "seeClass" (seeClass.cls) is a Visual Basic class wrapper for making calls to SEE32.DLL. The class name for each function is the same as the DLL function, except the leading "see" is replaced by "f".
Those functions that return strings do so by use of the "String Result" property.
Instantiate seeClass as any
other class in Visual Basic:
Dim X As New seeClass
Also see the SEE4VB Reference Manual (SEE4VB_R.TXT), the example project "StatProj" and the file seeClass.txt.
The use of seeClass is limited to Visual Basic 5.0 and above since previous versions of Visual Basic do not support classes.
The Visual Basic language use a technique known as "garbage collection" to manage string space at runtime, and may be called internally at any time by the Visual Basic runtime, asynchronous to what you may be doing in your code.
When passing a string buffer to a DLL function into which text will be copied, it is strongly recommended that the local string be allocated immediately before use. For example, a string buffer is passed to the dllGetMessage function, which copies a text message into it. Note that SPACE$(80) is called immediately before dllGetMessage.
Dim Code As Integer Dim Buffer As String * 80 ' allocate buffer just before call to dllGetMessage Buffer = SPACE$(80) ' copy message into 'Buffer' Code = dllGetMessage(Buffer, 80) ' message text is now in 'Buffer'
This technique is not necessary for passing a string to a DLL function, only when passing a buffer to a DLL into which data is to be placed by the DLL function.
SEE16.DLL and SEE32.DLL have a keycode encoded within them. Your keycode is a 9 or 10 digit decimal number (unless it is 0), and will be found in the file KEYCODE.BAS. The keycode for the shareware version is 0. You will receive a new key code when registering.
If you get an error message (value -74) when calling seeAttach, it means that the keycode in your application does not match the keycode in the DLL. After registering, it is best to remove the shareware version of the SEE DLL's from the Windows search path.
Several example programs are included in SEE4VB. Separate versions for Win16 and Win32 are included. There is also an example program (StatProj) which uses the VB class "seeClass".
Each example program (except StatProj) comes with a VB makefile. WIN16 makefile names end with "16.MAK" (e.g.: SEEVER16.MAK) while WIN32 makefiles end with "32.MAK" (e.g.: SEEVER32.MAK).
The first example program SEEVER displays the SEE library version number and registration string. It does not require a connection. Open project SEEVER16.MAK or SEEVER32.MAK.
Before writing your own programs, compile and run several of the example programs.
There are five SMTP example programs. SMTP programs send email.
HELLO emails a short message. You must edit HELLO16.FRM (or HELLO32.FRM) with your server and email address before compiling.
Open project HELLO16.MAK or HELLO32.MAK.
MAILER emails a message, including optional MIME attachments. All required parameters are input using a dialog box at runtime. Open project MAILER16.MAK or MAILER32.MAK.
Note that <> brackets are required around the email address.
BCAST (Broadcast) emails the same message to each recipient from a file of email addresses. Along with your SMTP server and your email address, you must create the file containing the email message to send, and create another file containing the list of recipients. See EMAIL.LST for an example.
Open project BCAST16.MAK or BCAST32.MAK.
Please DO NOT use this for spam!
RegMe (Register Me) connects to your SMTP server in order to allow a third party (such as your customers) to send you email, such as registration information.
Edit your TCP/IP parameters in RegMe16.FRM (line 125) and RegMe32.FRM (line 149) before compiling.
Open project REGME16.MAK or REGME32.MAK.
AUTO ("auto-responder") uses two channels concurrently to automatically respond to all new email. Edit your TCP/IP parameters in AUTO16.FRM (line 57) and AUTO32.FRM (line 73) before compiling.
Open project AUTO16.MAK or AUTO32.MAK.
There are five POP3 example programs. These examples read email.
STATUS reads the number of email messages waiting on your POP3 server, and displays the "DATE:", "FROM:", and "SUBJECT:" header fields from each email. All required parameters are input at runtime.
Open project STATUS16.MAK or STATUS32.MAK.
READER can read email, including multiple MIME attachments, from your POP3 server, optionally deleting each email after being read. All required parameters are input at runtime.
Open READER16.MAK or READER32.MAK.
VERUSR (Verify User) connects to a specified SMTP server and requests verification of the user.
Due to security concerns, some SMTP servers will not honor a "verify user" request. A user that does not verify does NOT necessarily mean that the email address is not good.
Open VERUSR16.MAK or VERUSR32.MAK.
GETRAW is a Win32 program that downloads a specified email message without decoding it. This is used to see what the email looks like on the server.
All required parameters are coded inside GETRAW16.FRM (line 66) and GETRAW32.FRM (line 67) and must be edited before compiling.
Open GETRAW16.MAK or GETRAW32.MAK.
STATPROJ gets the number of email messages waiting on your POP3 server.
The "StatProj" example uses the Visual Basic class seeClass.cls. For more details on the seeClass, refer to section 2.3 "SEE4VB Class".
All required parameters are input at runtime. Open STATPROJ.VBP from Visual Basic 5.0 (or above).
The SMTP/POP3 Email Engine DLLs (SEE16.DLL and SEE32.DLL) are written in ANSI C. All language versions of SEE (C/C++, Delphi, Visual Basic, PowerBASIC, FoxPro, Delphi, Xbase++, COBOL, and Fortran) use the same identical DLLs.
Version 1.0: June 22, 1998.
Version 2.0: September 28, 1998.
Version 2.1: November 28, 1998.
Version 3.0: April 12, 1999.
Version 3.1: July 16, 1999.
Version 3.2: January 17, 2000.