/*Simple script to Send a note as a mail*/

if ~show('L','rexxsupport.library') then if ~addlib('rexxsupport.library',0,-30,0) then do
	'echo You need rexxsupport.library.'
	exit 10
end

address 'blocnotes.rexx'
options results

/*********************ATTENTION**********************/
/* MUST be definded envinronment variable SENDMAIL  */
/****************************************************/

SENDMAIL=getenv('SENDMAIL')

/****************************************************/

/*Get the id of the note*/

parse arg id .

ISANOTE id
if RESULT=1 then do     /* Check if the id is valid*/
   GETLINE id 0
   ln=RESULT
   if pos('To:',ln)>0 then do
      export id 'T:msg'||id
      address command SENDMAIL||' T:msg'||id||' >t:ret'
      address command 'requestchoice TITLE Mail GADGETS Ok BODY "`type t:ret`"'
      address command 'delete T:msg'||id
      address command 'delete T:ret'
   end
end
