Chris Bartram's recent post about e-mailing spoolfiles prompted me to come up
with the following freeware solution that I've wanted to write for a long
time now.
He used a Content-Type of text/html and wrapped the message bodies in
<PRE>...</PRE> in order to force a mono-spaced client font. (Chris, did
you remember to escape special HTML characters like & < > % which might
be found in spoolfiles?).
I take the approach of text/plain, which on the Outlook and Netscape e-mail
clients we use here result in a mono-spaced font. Plus I don't have to
escape any special HTML characters (i.e. < must be changed to <, >
becomes >, & becomes & etc).
The following CI command file will e-mail a set of spoolfiles. The first
message body part is a :LISTSPF display of the files matching the selection
criteria, followed by individual attachments for each spoolfile.
Enjoy!
- Mark B.
parm recipients=!HPUSER.!HPACCOUNT,&
subject='HP3000 spoolfiles',&
seleq="jobnum=!HPJOBTYPE!HPJOBNUM",&
entry=main
comment This MAILSPF command file e-mails one or more output spoolfiles as MIME
comment multipart attachments. Syntax:
comment
comment mailspf recipients="[log in to unmask], [log in to unmask], ...",
comment subject="subject header of e-mail message",
comment seleq=":LISTSPF SELEQ criteria *without* []"
comment
comment The default SELEQ criteria will select all output spoolfiles created
comment by the session or job that is invoking MAILSPF.
comment
comment An example of a job that e-mails all of its created spoolfiles:
comment
comment job reports,user.account
comment comment generate first report spoolfile
comment run report1
comment comment generate second report spoolfile
comment run report2
comment comment e-mail all spoolfiles (including $STDLIST)
comment xeq mailspf [log in to unmask],"Output from the reports job"
comment eoj
comment
comment MAILSPF was developed under MPE/iX 5.5 PowerPatch4 and uses Sendmail/iX
comment (http://www.cccd.edu/~markb/sendmailix.html) as a mail transport. Note
comment that other mail transports may be used as long as the transport will
comment accept a fully formatted message that includes headers.
comment
comment Where to obtain this CI command file:
comment
comment http://www.cccd.edu/ftp/pub/mpe/mailspf
comment or
comment ftp://ftp.cccd.edu/pub/mpe/mailspf
comment
comment How to contact the author:
comment
comment Mark Bixby
comment Coast Community College District
comment District Information Services
comment 1370 Adams Ave
comment Costa Mesa, CA 92626-5429
comment voice: +1 714 438-4647
comment email: [log in to unmask]
comment web: http://www.cccd.edu/~markb
comment
comment Change History
comment
comment 1.0 April 8, 1998
comment
comment Initial public release.
if UPS("!entry") = 'MAIN' then
comment
comment Purge the :LISTSPF temp output file if it exists.
comment
file mailspfl,oldtemp
if FINFO('*mailspfl','exists') then
purge mailspfl,temp
endif
comment
comment Call :LISTSPF with the selection criteria and capture the output.
comment
file mailspfl;temp;rec=,,b;disc=2147483647
setvar CIERROR 0
setvar JCW 0
continue
listspf o@;detail;seleq=[!seleq] >*mailspfl
if CIERROR <> 0 or JCW <> 0 then
comment
comment Something went wrong. Stop.
comment
print mailspfl
purge mailspfl,temp
reset mailspfl
return
endif
file mailspfl,oldtemp
comment
comment Purge the mail message temp file if it exists.
comment
file mailspfm,oldtemp
if FINFO('*mailspfm','exists') then
purge mailspfm,temp
endif
comment
comment Start creating the message as a temp file.
comment
build mailspfm;temp;rec=,,b;disc=2147483647
comment Generate a MIME boundary string.
setvar mailspf_sep RHT(RPT('-',36)+"!HPSUSAN!HPPIN!HPCPUMSECS",36)
comment
comment Generate all of the message headers.
comment
echo To: !recipients>*mailspfm
if HPJOBNAME = '' then
setvar mailspf_from &
'"#!HPJOBTYPE!HPJOBNUM !HPUSER.!HPACCOUNT" !<!HPUSER.!HPACCOUNT!>'
else
setvar mailspf_from &
'"#!HPJOBTYPE!HPJOBNUM !HPJOBNAME,!HPUSER.!HPACCOUNT" !<!HPUSER.!HPACCOUNT!>'
endif
echo From: !mailspf_from >>*mailspfm
echo Subject: !subject>>*mailspfm
echo MIME-Version: 1.0>>*mailspfm
echo Content-Type: multipart/mixed; boundary="!mailspf_sep">>*mailspfm
echo >>*mailspfm
comment
comment Generate the preamble (not normally displayed by MIME mail clients).
comment
echo This is a multi-part message in MIME format.>>*mailspfm
comment
comment Generate the first body which contains the :LISTSPF output.
comment
echo --!mailspf_sep>>*mailspfm
echo Content-Type: text/plain; charset=us-ascii>>*mailspfm
echo Content-Transfer-Encoding: 7bit>>*mailspfm
echo >>*mailspfm
print *mailspfl >>*mailspfm
comment
comment Generate a body for each spoolfile.
comment
xeq !HPFILE entry=listspf <*mailspfl
comment
comment That's all, folks.
comment
echo --!mailspf_sep-->>*mailspfm
comment
comment Mail the message.
comment
xeq SENDMAIL.PUB.SENDMAIL "-t" <*mailspfm
comment
comment Clean up.
comment
purge mailspfl,temp
purge mailspfm,temp
reset mailspfl
reset mailspfm
reset mailspfs
deletevar mailspf_@
elseif UPS("!entry") = 'LISTSPF' then
comment
comment Scan the :LISTSPF output, looking for spoolfile lines.
comment
while SETVAR(mailspf_word,&
STR(SETVAR(mailspf_line,INPUT()),1,POS(' ',mailspf_line)-1)) <> 'INPUT' do
if LFT(mailspf_word,1) = '#' then
comment
comment Found a spoolfile; generate a message body for it.
comment
xeq !HPFILE entry=file
endif
endwhile
elseif UPS("!entry") = 'FILE' then
comment
comment Do a magic :FILE equate for the spoolfile name.
comment
setvar mailspf_file RHT(mailspf_word,-2)+'.OUT.HPSPOOL'
file mailspfs=!mailspf_file,old;nomulti
comment
comment Generate the body headers.
comment
echo --!mailspf_sep>>*mailspfm
echo Content-Type: text/plain; charset=us-ascii; name="!mailspf_file">>*mailspfm
echo Content-Transfer-Encoding: 8bit>>*mailspfm
echo >>*mailspfm
comment
comment Generate the body content. Note that CCTL bytes are stripped.
comment
xeq CAT.HPBIN.SYS <*mailspfs >>*mailspfm
endif
--
Mark Bixby E-mail: [log in to unmask]
Coast Community College Dist. Web: http://www.cccd.edu/~markb/
District Information Services 1370 Adams Ave, Costa Mesa, CA, USA 92626-5429
Technical Support Voice: +1 714 438-4647
"You can tune a file system, but you can't tune a fish." - tunefs(1M)
|