Banyan SENDMAIL.DLL Simple Mail Interface

This file is for informational purposes only, subject to change without notice and does not constitute a warranty by Banyan. Banyan shall not be liable for technical or editorial errors or omissions nor for special, indirect, incidental or consequential damages resulting from the furnishing, performance or use of this information. The terms and conditions with respect to the sale and/or licensing of this Banyan Product are defined in agreements with Banyan or its authorized resellers and/or Banyan's Shrink Wrap licenses and/or third party agreements or shrink wrap licenses.

Banyan and VINES are registered trademarks, and the Banyan logo, StreetTalk, and Intelligent Messaging are trademarks of Banyan Systems Incorporated. StreetTalk is a product of Banyan Systems Incorporated and not a product of McCarthy, Crisanti & Maffei, Inc. All other brand and product names are trademarks or registered trademarks of their respective owners.

(c)  1994 Banyan Systems Incorporated  All Rights Reserved. Made in U.S.A.


_________________________________________________________________________________________

File's included:

SENDMAIL.DLL 	- Brings up Send Banyan Mail Form
VNSDLG.DLL	 - STDA browser
VNSDLGR.DLL	 - Resource for STDA browser
SENDMAIL.H   	- Header file for SENDMAIL.DLL
VNSDLG.H   	- Header file for VNSDLG.DLL
XCMC.H	   	- Header file for CMC compliancy
BANSEND.HLP	 - SENDMAIL.DLL help file - must be in same dir as SENDMAIL.DLL
VNSDLG.HLP 	- VNSDLG.DLL help file -	""	   ""		      ""
SENDMAIL.LIB 	- Import library for SENDMAIL.DLL
VNSDLG.LIB 	- Import library for VNSDLG.DLL

API's exposed in SENDMAIL.DLL (also sample code fragments showing usage) are shown
below:
_____________________________________________________________________________

The following API is a simple interface to provide the ability from a Vines Windows workstation to send a mail message containing a single file attachment to one or more recipients.  The API will present a dialog box that utilizes Vines STDA to select addressing for the To:, Cc: and Bcc: recipients as well as specify a Subject and short message.

	CallStatus = VnsSimpleSendMail( LPSTR lpFileName ); 

A subclassed version of the above VnsSimpleSendMail() is as follows which allows the caller to include 
in the argument list a window handle that the VnsSimpleSendMail() API will use for it's focus:

	CallStatus = VnsSimpleSendMailH( HWND hWnd, LPSTR lpFileName);


Example Code for VnsSimpleSendMail() API

#include "sendmail.h"
CallStatus   iCallRet;

/* Easiest of the calls to use, does everything for you */
/* All you pass it is a name of a file to be mailed	*/

iCallRet = VnsSimpleSendMail( "TEST.TXT" );

/* Error codes other than zero can be explained using the call VNSERR error# */
/* example:   VNSERR 3019 */



The following interface provides an extension of the simple interface above for a Vines Windows application to generate a mail message with multiple attachments, as well as the ability to specify directly your own recipient lists (if you want to do your own To:, Cc: and Bcc: dialog boxes).  

CallStatus = VnsSimpleSendMailEx( LPBODY_PIECES lpBodyPieces, LPSTR lpRecips ) ---

LPBODY_PIECES  lpBodyPieces;  	 /* Instead of having SENDMAIL.DLL to package
				  up a file to send, this structure allows
				  you to send mutiple files as attachments
				  and gives you a bit more control and
				  flexibility  */
LPSTR	       lpRecips;  		 /* Also if you pass in a pointer to recipient
				  names, the browser will NOT come up. A
				  NULL will bring up the STDA browser */

The subclassed version of the VnsSimpleSendMailEx() API is as follows:

CallStatus = VnsSimpleSendMailExH( 	HWND hWnd, 			// Parent Window Handle
				LPBODY_PIECES lpBodyPieces, 	// body pieces, Cc: & Bcc:
				LPSTR lpRecips );			// Msg To: recipients


Example Code for VnsSimpleSendMailEx() API

HANDLE	       hFolder;        /* Handle to folder */
LPSTR	       lpFolder;       /* Pointer to folder name */
HANDLE	       hBodyPieces;
LPBODY_PIECES  lpBodyPieces;
HANDLE	       hTmpText, hAttach1, hMainBody;
LPSTR	       lpTmpText, lpAttach1, lpMainBody;

hBodyPieces = GlobalAlloc( GHND, (DWORD)sizeof( BODY_PIECES ));
lpBodyPieces = ( LPBODY_PIECES )GlobalLock( hBodyPieces );

/* Folder name of where to send message to */
hFolder = GlobalAlloc( GHND, (DWORD)16 );
lpFolder = GlobalLock( hFolder );
lstrcpy( lpFolder, "General" );
lpBodyPieces->hGenFolder = hFolder;
GlobalUnlock( hFolder );

/* Folder name where to put message after sending */
hFolder = GlobalAlloc( GHND, (DWORD)16 );
lpFolder = GlobalLock( hFolder );
lstrpcy( lpFolder, "Wastebasket" );
lpBodyPieces->hWasteFolder = hFolder;
GlobalUnlock( hFolder );

/* Subject field */
hTmpText = GlobalAlloc( GHND, (DWORD)60 );
lpTmpText = GlobalLock( hTmpText );
lstrcpy( lpTmpText, "Test Subject" );
lpBodyPieces->hSubject = hTmpText );
GlobalUnlock( hTmpText );

lpBodyPieces->bNorm = TRUE; /* Normal message */
lpBodyPieces->bHigh = FALSE; /* High priority */
lpBodyPieces->bLow = FALSE; /* Low priority */

lpBodyPieces->bCert = FALSE; /* Certified ?*/

/* Number of attachments, two in this case - main body and 1 attachment */
lpBodyPieces->iNumBodyPieces = 2;

/* Brings up the STDA browser */
lpRecips = NULL;

/* Set up body part structure */
hMainBody = GlobalAlloc( GHND, (DWORD)750 );
lpMainBody = GlobalLock( hMainBody );
lstrcpy( lpMainBody, "TEST MAIN BODY" );
lpBodyPieces->BodyPieces[0].bFile = FALSE;
lpBodyPieces->BodyPieces[0].contentType = FREETXT2;
lpBodyPieces->BodyPieces[0].hBodyElement = hMainBody;
GlobalUnlock( hMainBody );

hAttach1 = GlobalAlloc( GHND, (DWORD)144 );
lpAttach1 = GlobalLock( hAttach1 );
lstrcpy( lpAttach1, "C:\\WIN31\\SYSTEM.INI" );
lpBodyPieces->BodyPieces[1].bFile = TRUE;
lpBodyPieces->BodyPieces[1].contentType = FREETXT2;
lpBodyPieces->BodyPieces[1].hBodyElement = hAttach1;
GlobalUnlock( hAttach1 );

iCallRet = VnsSimpleSendMailEx( LPBODY_PIECES lpBodyPieces, LPSTR lpRecips );

/* Error codes other than zero can be explained using the call VNSERR error# */
/* example:   VNSERR 3019 */

______________________________________________________________________________

CMC compliancy ---

The following calls allow for a developer that is coding to the CMC
specification to create an interface to Intelligent Messaging very rapidly. Please note at this point
the CMC interface has not been thoroughly tested, so use with caution.

Example follows:

#include "xcmc.h"
#include "sendmail.h"

CMC_return_code    CMCcallret;
CMC_session_id	   CMC_session;

/* Start a mail session */
CMCcallRet = cmc_logon( "MS@Tamerlane@Servers",
			"Mike Smith@Eng@CMC",
			NULL, NULL, NULL, NULL, NULL
			&CMC_session, NULL );

/* Send a mail message */
CMCcallRet = cmc_send( CMC_session, "C:\\TESTFILE.TXT",
		       NULL, NULL, NULL );

/* End the mail session */
CMCcallRet = cmc_logoff( CMC_session, NULL, NULL, NULL );