



                           SMTP Email Engine

                           Library for Fortran

                                 (SEE4F)


                            REFERENCE MANUAL



                               Version 1.0

                               June 11, 1998




                     This software is provided as-is.
              There are no warranties, expressed or implied.




                           Copyright (C) 1998
                           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

                               _______
                          ____|__     |                (R)
                       --+       |    +-------------------
                         |   ____|__  |  Association of
                         |  |       |_|  Shareware
                         |__|   o   |    Professionals
                       --+--+   |   +---------------------
                            |___|___|    MEMBER


      MARSHALLSOFT is a registered trademark of MarshallSoft Computing.





     SEE4F Reference Manual                                    Page 1

                            C O N T E N T S



        Chapter                                     Page

        Table of Contents.............................2

        General Remarks...............................3

        SEE Functions.................................3

           seeClose...................................3

           seeConnectTo...............................4

           seeDriver..................................5

           seeErrorText...............................6

           seeIntegerParam............................7

           seeSendEmail...............................8

           seeStatistics..............................9

           seeStringParam............................10

           seeVerifyFormat...........................11

        SEE Error Codes..............................12



























     SEE4F Reference Manual                                    Page 2


      General Remarks


      All functions return an integer code. Negative values are always
      errors. See section "SEE Error Codes". Non-negative return codes are
      never errors.

      Note that all strings are null terminated. For example:

      CHARACTER*64 Filename

      Filename = 'SEE4F10.ZIP' // CHAR(0)

      Also note the use of the VAL and LOC operators. The VAL operator is
      used to pass an argument by value rather than by reference, and the
      LOC operator is used to pass the address of a variable without the
      extra hidden length argument passed for CHARACTER variables.


      SEE Functions



      +----------+--------------------------------------------------------+
      | seeClose | Closes SMTP Email Engine.                              |
      +----------+--------------------------------------------------------+


        SYNTAX  INTEGER*4 seeClose()

       REMARKS  The seeClose function closes the connection created by
                calling seeConnectTo. seeConnectTo can be called again to
                open a connection to another SMTP server if desired.

                Normally, there is only one seeConnectTo and one seeClose
                in your program.

       RETURNS  < 0 : An error has occured. See the error list.

       EXAMPLE

                C    ... call after sending all email.
                     Code = seeClose()

      ALSO SEE  seeConnectTo.












     SEE4F Reference Manual                                    Page 3


      +--------------+----------------------------------------------------+
      | seeConnectTo | Connects to SMTP server.                           |
      +--------------+----------------------------------------------------+


        SYNTAX  INTEGER*4 seeConnectTo(
                 1   VAL(LOC(Server)),  ! SMTP server.
                 2   VAL(LOC(From)),    ! Your email address in brackets.
                 3   VAL(LOC(ReplyTo))) ! Email address to reply to.
                  CHARACTER*64 Server
                  CHARACTER*64 From
                  CHARACTER*64 ReplyTo

       REMARKS  The seeConnectTo function establishes a connection with the
                SMTP server as specified by the Server argument.

                Your SMTP server name will typically be named
                "mail.XXX.com" where XXX is your email address, such as
                name@XXX.com. Your SMTP server name can also be found in
                the setup information for your normal email client, such as
                Eudora or Microsoft Outlook.

                The SMTP server name can also be specified in dotted
                decimal notation if wanted. For example "10.23.231.1".

                The From string is required and must be enclosed in "<>"
                brackets, such as <mike@marshallsoft.com>.

                The ReplyTo string is optional and is used for the
                "Reply-To:" header line. If used, the email address must be
                enclosed in "<>" brackets.


       RETURNS  < 0 : An error has occured. See the error list.

       EXAMPLE

                  CHARACTER*64 Server
                  CHARACTER*64 From
                  CHARACTER*64 ReplyTo

                  Server = 'mail.yourisp.net' // CHAR(0)
                  From   = 'mike<mike@marshallsoft.com>' // CHAR(0)
                  ReplyTo= 'pam<pam@marshallsoft.com>' // CHAR(0)

                  Code = seeConnectTo(
                 1   VAL(LOC(Server)),  ! SMTP server.
                 2   VAL(LOC(From)),    ! Your email address in brackets.
                 3   VAL(LOC(ReplyTo))) ! Email address to reply to.

      ALSO SEE  seeClose.






     SEE4F Reference Manual                                    Page 4


      +-----------+-------------------------------------------------------+
      | seeDriver | Executes next SEE state.                              |
      +-----------+-------------------------------------------------------+


        SYNTAX  INTEGER*4 seeDriver()

       REMARKS  The seeDriver function executes the next state in SEE16.DLL
                or SEE32.DLL after calling seeConnectTo, seeSendEmail, or
                seeClose provided that the AUTO_DRIVER_CALL flag is
                disabled.

                The purpose of this function is to allow the programmer to
                get control after the driver executes each state.

       RETURNS  = 0 : The driver is done.
                < 0 : An error has occured. See the error list.
                > 0 : The returned value is the state just executed.

       EXAMPLE

                    Counter = 0
                100 Code = seeDriver()
              C     ...error ?
                    IF(Code .LT. 0) THEN
                      WRITE(*,*) 'seeDriver returns error ', Code
                      STOP
                    END IF
              C     ...good return code ?
                    IF (Code .GT. 0) THEN
                      GOTO 100
                    END IF
              C     ...Code must be 0 (Driver is done)

      ALSO SEE  seeIntegerParam






















     SEE4F Reference Manual                                    Page 5


      +--------------+----------------------------------------------------+
      | seeErrorText | Get text associated with error code.               |
      +--------------+----------------------------------------------------+


        SYNTAX  INTEGER*4 seeErrorText(
                 1   VAL(Code),        ! Error code returned by SEE.
                 2   VAL(LOC(Buffer)), ! Buffer to place error text into.
                 3   VAL(BufLen))      ! Length of above Buffer.
                  INTEGER*4 Code
                  CHARACTER*64 Buffer
                  INTEGER*4 BufLen

       REMARKS  The seeErrorText function is used to get the error text
                associated with an an error code as returned by
                selConnectTo, seeSendEmail, seeClose, or seeDriver.

                When an error occurs, seeErrorText can be used to get the
                error text so that it can be displayed for the user.

       EXAMPLE

                  CHARACTER*64 Buffer
                  INTEGER*4 Code

                  Code = seeErrorText(
                 1   VAL(Code),        ! Error code returned by SEE
                 2   VAL(LOC(Buffer)), ! Buffer to place error text into.
                 3   VAL(64))          ! Length of above Buffer.

      ALSO SEE


























     SEE4F Reference Manual                                    Page 6


      +-----------------+-------------------------------------------------+
      | seeIntegerParam | Sets SEE integer parameter.                     |
      +-----------------+-------------------------------------------------+


        SYNTAX  INTEGER*4 seeIntegerParam(
                 1   VAL(ParmIndex),  ! Parameter index (see below).
                 2   VAL(ParmValue))  ! Value of parameter to set.
                  INTEGER*4 ParmIndex
                  INTEGER*4 ParmValue

       REMARKS The seeIntegerParam is used to set an integer parameter as
                defined in SEE4H.INC. For more information, refer to the
                Users Manual. All times are in milliseconds.

                        Parameter Name     Default
                 SEE_MIN_RESPONSE_WAIT  :  500
                 SEE_MAX_RESPONSE_WAIT  :  10000
                     SEE_MIN_LINE_WAIT  :  5
                     SEE_MAX_LINE_WAIT  :  10000
                      SEE_CONNECT_WAIT  :  60000
                  SEE_QUOTED_PRINTABLE  :  0
                  SEE_AUTO_CALL_DRIVER  :  1

                SEE_MIN_RESPONSE_WAIT is the delay before looking for the
                server's response.

                SEE_MAX_RESPONSE_WAIT is the time after which a "time-out"
                error ocurrs if the server has not responded.

                SEE_MIN_LINE_WAIT is the delay before checking if the
                server is ready to accept the next line of input.

                SEE_MAX_LINE_WAIT is the time after which a "time-out"
                error is declared if the server has not responded.

                SEE_CONNECT_WAIT is the maximum time allowed to complete a
                connection to the SMTP server.

                SEE_QUOTED_PRINTABLE controls the whether messages are (1)
                or are not (0) encoded as quoted-printable.

                SEE_AUTO_CALL_DRIVER controls whether ssDriver is called
                automatically (to completion) after seeConnectTo,
                seeSendEmail, or seeClose is called.

       EXAMPLE

                Code = seeIntegerParam(
               1   VAL(SEE_AUTO_CALL_DRIVER),  ! Disable auto call
               2   VAL(0))                     ! off (disabled)

      ALSO SEE  seeStringParam.




     SEE4F Reference Manual                                    Page 7


      +--------------+----------------------------------------------------+
      | seeSendEmail | Sends email and attachments.                       |
      +--------------+----------------------------------------------------+

        SYNTAX  INTEGER*4 seeSendEmail(
                 1   VAL(LOC(To)),     ! Receipient, separated by commas.
                 2   VAL(LOC(CC)),     ! CC list, separated by commas.
                 3   VAL(LOC(BCC)),    ! BCC list, separated by commas.
                 4   VAL(LOC(Subj)),   ! Subject text.
                 5   VAL(LOC(Msg)),    ! Message or message filename.
                 6   VAL(LOC(Attach))) ! File attachment.
                  CHARACTER*64 To
                  CHARACTER*64 CC
                  CHARACTER*64 BCC
                  CHARACTER*64 Subj
                  CHARACTER*64 Msg
                  CHARACTER*64 Attach

       REMARKS  The seeSendEmail function is used to send email once a
                conection has been made to your SMTP server after calling
                seeConnectTo. Note that all email addresses (in To, CC,
                and BCC strings) must be bracketed, for example:
                   <mike@marshallsoft.com>

                The CC and BCC strings may contain multiple email
                addresses, separted by commas. For example:
                   "Billy Bob<bbob@isp.com>,Buster<bm@isp.com>"

                If the first character of the message (fifth argument) is
                a '@', then it is considered as the filename which contains
                the message to send.

       RETURNS  < 0 : An error has occured. See the error list.

       EXAMPLE

                 CHARACTER*64 EMAIL_TO
                 CHARACTER*64 EMAIL_SUBJ
                 CHARACTER*64 EMAIL_MSG

                 EMAIL_TO = "<mike@marshallsoft.com>" // CHAR(0)
                 EMAIL_SUBJ = "Fortran Test" // CHAR(0)
                 EMAIL_MSG = "@message.mai" //CHAR(0)

                Code = seeSendEmail(
               1   VAL(LOC(EMAIL_TO)),      ! receipient
               2   VAL(0),                  ! no CC list
               3   VAL(0),                  ! no BCC list
               4   VAL(LOC(EMAIL_SUBJ)),    ! email subject
               5   VAL(LOC(EMAIL_MSG)),     ! text of message
               6   VAL(0) )                 ! no attachment

      ALSO SEE seeConnectTo




     SEE4F Reference Manual                                    Page 8


      +---------------+---------------------------------------------------+
      | seeStatistics | Returns runtime statistics.                       |
      +---------------+---------------------------------------------------+


        SYNTAX  INTEGER*4 seeStatistics(
                 1  VAL(Index))   ! Specifies which statistic.
                  INTEGER*4 Index

       REMARKS  The seeStatistics function is used to return runtime
                statistics in the SEE DLL. The values of Index are defined
                in SEE4F.INC as follows:

                   SEE_GET_SOCK_ERROR : Gets last socket error.
                      SEE_GET_COUNTER : Gets # times driver called.
                     SEE_GET_RESPONSE : Gets last SMTP response code.

                SEE_GET_MESSAGE_BYTES_READ : Gets # message bytes read.
                 SEE_GET_ATTACH_BYTES_READ : Gets # attachment bytes read.
                  SEE_GET_TOTAL_BYTES_READ : Gets total of above two.

                SEE_GET_MESSAGE_BYTES_SENT : Gets # message bytes sent.
                 SEE_GET_ATTACH_BYTES_SENT : Gets # attachment bytes sent.
                  SEE_GET_TOTAL_BYTES_SENT : Gets total of above two.

                The number of message bytes sent will usually be larger
                than your message size because of SMTP protocol overhead.

                The number of attachment bytes sent will be at least
                one-third larger than the actual attachment since every 3
                bytes are encoded as 4 7-bit ASCII bytes before being
                transmitted.

                The purpose of "...BYTES_READ" and "...BYTES_SENT" is to
                provide the ability to track the transmission progress of
                large messages and attachments. See the DRIVER example
                program.

       EXAMPLE

                C     ...get total message & attachment bytes transmitted.
                      Code = seeStatistics(VAL(SEE_GET_TOTAL_BYTES_SENT))

      ALSE SEE  seeDriver, seeIntegerParam and seeStringParam.













     SEE4F Reference Manual                                    Page 9


      +----------------+--------------------------------------------------+
      | seeStringParam | Sets SEE string parameter.                       |
      +----------------+--------------------------------------------------+


        SYNTAX  INTEGER*4 seeStringParam(
                 1  VAL(ParamName),           ! Index of parameter.
                 2  VAL(LOC(ParamString)))    ! Parameter string.
                  INTEGER*4  ParamName
                  CHARACTER* ParamString

       REMARKS  The seeStringParam function is used to set a string
                parameter as defined in SEE4F.INC. For more information,
                refer to the Users Manual.

                SEE_LOG_FILE : Specifies the log filename.

                The log file is used to debug a SMTP session. Be advised
                that log files can be quite large. Don't use them unless
                necessary.

       EXAMPLE

                CHARACTER*64 LOG_FILENAME
                LOG_FILENAME = "test.log" // CHAR(0)

                Code = seeStringParam(
               1  VAL(SEE_LOG_FILE),
               2  VAL(LOC(LOG_FILENAME)))

      ALSO SEE seeIntegerParam


























     SEE4F Reference Manual                                    Page 10


      +-----------------+-------------------------------------------------+
      | seeVerifyFormat | Check email address format.                     |
      +-----------------+-------------------------------------------------+


        SYNTAX  INTEGER*4 seeVerifyFormat(
                 1   VAL(LOC(String)))  ! Email address to check.
                  CHARACTER*64 String

       REMARKS  The seeVerifyFormat function is use to test an individual
                email address for proper formatting. If this function
                returns 0 or above, then the email address is properly
                formatted. But, if this function returns a negative value,
                the email address is either badly formatted, or it uses
                characters (such as '%') that are not normally used as part
                of an email address.

                Note that left and right brackets ('<' and '>') must
                surround the email address.

       EXAMPLE

                CHARACTER*64 EMAIL_ADDR
                EMAIL_ADDR = "Billy Bob<beb@hisasp.com>" // CHAR(0)

                Code = seeVerifyFormat(VAL(LOC(EMAIL_ADDR)))

      ALSO SEE seeErrorText





























     SEE4F Reference Manual                                    Page 11

                          SEE Error Codes




      +-----------------------+-----------------------------------------+
      | SEE_NO_ERROR          | No error.                               |
      | SEE_CANNOT_COMPLY     | Cannot comply. Not always an error.     |
      +-----------------------+-----------------------------------------+
      | SEE_EOF               | End of file (socket has been closed).   |
      | SEE_IS_BLOCKING       | Socket is currently blocking.           |
      | SEE_BAD_DOTTED        | Bad dotted address.                     |
      | SEE_TIMED_OUT         | Socket timed out awaiting data.         |
      | SEE_ABORTED           | The DLL has been corrupted.             |
      | SEE_ALREADY_CONNECTED | Already connected to server.            |
      | SEE_BACK_OVERFLOW     | Response buffer has overflowed.         |
      | SEE_BAD_ADDRESS_CHAR  | Bad character in email address.         |
      | SEE_CANNOT_ATTACH     | Cannot access WINSOCK                   |
      | SEE_CANNOT_OPEN       | Cannot open file.                       |
      | SEE_CONNECT_ERROR     | Error attempting to connect.            |
      | SEE_EMPTY_ADDRESS     | EMPTY email address.                    |
      | SEE_FROM_NULL_ARG     | FromPtr is NULL.                        |
      | SEE_MISSING_AT_CHAR   | Missing '@' character in email address. |
      | SEE_MISSING_FROM      | Missing FROM email address.             |
      | SEE_MISSING_LEFT      | Missing '<' delimiter in email address. |
      | SEE_MISSING_RIGHT     | Missing '>' terminating email address.  |
      | SEE_NOT_CONNECTED     | Not connected to server                 |
      | SEE_NO_RECEIPIENTS    | Must have at least one receipient.      |
      | SEE_NO_SERVER         | Cannot find Smtp server.                |
      | SEE_NULL_POINTER      | Unexpected NULL pointer.                |
      | SEE_RCPT_NULL_ARG     | ToPtr is NULL.                          |
      | SEE_SMTP_ERROR        | SMTP returned error.                    |
      | SEE_SMTP_NULL_ARG     | SMTP Server not specified.              |
      | SEE_SOCK_READ_ERROR   | Socket read error.                      |
      | SEE_SOCK_WRITE_ERROR  | Socket write error.                     |
      | SEE_TOO_MANY_AT_CHARS | Too many '@' symbols in email address.  |
      +-----------------------+-----------------------------------------+

      NOTES:

      (1) All error codes are negative.
      (2) SEE_ABORTED will be returned if the DLL has been modified. You
          should never get this message!















     SEE4F Reference Manual                                    Page 12


