Compile function Send_Email_Sample(SendTo, CC, Subject, Body, From, ReplyTo, SRPMailAttach, ConfigFile, Bcc)

************************************************************************************************
*
* This program is proprietary and is not to be used by or disclosed to others, nor is it to
* be copied without written permission from SRP Computer Solutions.
*
* Name       :  Send_Email_Sample
*
* Description:  Sends an email via the SRPMail.dll
*
* Notes      :  Please refer to the SRPMail.chm
*
* Parameters :
*   MsgSent			[out] -- Returns a boolean value as to whether or not the message was sent
*						 	 successfully
*	SendTo			[in]  -- An @VM delimited list of email addresses; required parameter
*	CC				[in]  -- An @VM delimited list of email addresses
*	Subject			[in]  -- Text that will appear in the subject line of the email
*	Body			[in]  -- The actual text of the email; use CRLF$ to break or insert lines;
* 						 	 required parameter
*   From 			[in]  -- The account to send the email from 
*	ReplyTo 		[in]  -- The account that all replies should go to.
*   SRPMailAttach	[in]  -- The file to be used as an attachment for the SRPMail program.
*	ConfigFile		[in]  -- The record which contains the SRPMail Config variables.
*   Bcc				[in]  -- An @VM delimited list of email address
*
* History (Date, Initials, Notes)
*	01/05/04  ps   Sample version created.
************************************************************************************************

$insert SRPMAIL_INSERTS
$insert LOGICAL

Process = 0
Error = No$
Loop
	Process += 1
Until Error OR Process GT 2
	On Process GoSub SET, SEND
Repeat

Return MsgSent

SET:
	MsgSent = No$
	If Assigned(SendTo) 	 	else SendTo  	= ""
	If Assigned(CC)     	 	else CC      	= ""
	If Assigned(From)   	 	else From    	= ""
	If Assigned(Subject)	 	else Subject 	= ""
	If Assigned(Body)   	 	else Body    	= ""
	If Assigned(aTitle) 		else aTitle     = ""
	If Assigned(aPath)		 	else aPath      = ""
	If Assigned(eDialog)	    else eDialog    = Yes$
	If Assigned(From)			else From       = ""
	If Assigned(ReplyTo)   		else ReplyTo	= ""
	If Assigned(SRPMailAttach)	else SRPMailAttach = ""
	If Assigned(ConfigFile)		else ConfigFile = ""
	If Assigned(Bcc)		 	else Bcc		= ""
	If Assigned(HistoryTable)	else HistoryTable = ""
	If SendTo EQ "" then Error = Yes$
	MsgSent = ""
return


SEND:
	Swap @VM with @FM in ConfigFile
	If ConfigFile then
		GoSub Send_SRP_Mail
	end else
		Error = Yes$
	end
return

Send_SRP_Mail:
	Swap @VM with ", " in SendTo
	Swap @VM with ", " in CC
	Swap @VM with ", " in Bcc
	Swap @VM with ", " in SRPMailAttach
	Swap @FM with ", " in SendTo
	Swap @FM with ", " in CC
	Swap @FM with ", " in Bcc
	Swap @FM with @VM in SRPMailAttach
	Message = ""
	Message<1> = Subject
	Message<2> = From
	Message<3> = SendTo
	Message<4> = CC
	Message<5> = Bcc
	Message<6> = ReplyTo
	HTMLCheck = Body[1, 6]
	Convert @LOWER_CASE to @UPPER_CASE in HTMLCheck
	If HTMLCheck EQ "<HTML>" then
		Message<7> = "HTML"
	end else
		Message<7> = "TEXT"
	end
	Message<8> = Body
	Message<9> = SRPMailAttach
	MsgSent = SRP_Send_Mail(Message, ConfigFile)
return
