PARM recip_addr,mailbox='',mailpass='',fid,subj='Message Subject',urg="N" comment comment SENDHTML.XEQ comment Author: Chris Bartram comment Modified: 01/07/2003 comment comment This command file sends the file identified by 'spid' as an comment *html* file to the mailbox 'recip_addr'. comment comment spid can be either: Onnn or nnn --> an MPE Spoolfile comment or comment filename[.grp[.acct]] -->MPE text file comment comment If 'recip_addr' starts with a "^", then it's treated as a filename comment from which a list of email addresses is read, one per line comment comment The mailbox used to send the message (from) is identified by the comment 'mailbox' variable, and that mailbox' password by 'mailpass' comment comment Example usage: comment (assuming this file is called 'sendhtml.xeq') comment :XEQ sendhtml.xeq joe@acme.com,admin,Apass,6702,'Quarterly Report' comment if bound(netmail_mailbox) then setvar save_netmail_mailbox "!netmail_mailbox" else setvar save_netmail_mailbox "*" endif if bound(netmail_mailbox_pwd) then setvar save_netmail_mailbox_pwd "!netmail_mailbox_pwd" else setvar save_netmail_mailbox_pwd "*" endif setvar netmail_mailbox '!mailbox' setvar netmail_mailbox_pwd '!mailpass' setjcw netmailsigprompt=2 setvar _urgflag ups("!urg") setvar _spoofle FALSE IF (numeric("!fid")) OR ((lft(ups("!fid"),1)="O") AND & numeric(rht("!fid",len("!fid")-1))) then setvar _spoofle TRUE ENDIF IF !_spoofle THEN IF ups(lft("!fid",1))<>"O" THEN setvar spid "/HPSPOOL/OUT/O!fid" ELSE setvar spid ups("/HPSPOOL/OUT/!fid") endif ELSE setvar spid "!fid" ENDIF setvar sprecs finfo("!spid","EOF")+100 comment (we gave sprecs a few extra records in case it's still growing) continue purge recplist,temp > $NULL build recplist;temp;rec=-80,,f,ascii;disc=1000;msg file rcp=recplist,oldtemp;acc=append file rcpin=recplist,oldtemp;acc=in IF lft("!recip_addr",1)="^" THEN comment read file to get list of recipients print ![rht("!recip_addr",len("!recip_addr")-1)];page=0;out=*rcp ELSE echo !recip_addr >> *RCP ENDIF setvar numrcpts finfo("recplist","EOF") IF !numrcpts<1 THEN echo echo No recipients provided echo SETVAR cmcm1t1 0 RETURN ENDIF continue purge report,temp > $null build report;temp;rec=-256,,f,ascii;disc=!sprecs;code=2133 file r=report,oldtemp;acc=append file htmlrep=report,oldtemp echo !!
! >> *r
comment
comment we print the spoolfile, starting at record #3 to get past the
comment initial CCTL codes at the beginning of the spool file
comment
IF !_spoofle THEN
  file sptemp=sptemp;dev=disc;disc=!sprecs
  continue
  xeq /bin/cat !spid > *sptemp
  reset sptemp
  print sptemp;page=0;out=*r
  purge sptemp,temp > $NULL
 ELSE
  print !spid;page=0;out=*r
ENDIF
CONTINUE
PURGE tmpx,temp > $NULL
IF "!_urgflag"="Y" THEN
  ECHO SEND *htmlrep;URGENT >> tmpx
 ELSE
  ECHO SEND *htmlrep >> tmpx
ENDIF
ECHO  >> tmpx
ECHO !subj >> tmpx
setjcw i=0
WHILE i> tmpx
  setjcw i=i+1
ENDWHILE
ECHO // >> tmpx
ECHO EXIT >> tmpx
continue
deletevar cmcm@ > $NULL
RUN NETMAIL.SYS.THREEK,BATCH;STDIN=TMPX;STDLIST=$NULL
continue
PURGE TMPX,TEMP > $NULL
continue
purge recplist,temp > $NULL
comment
comment if this message was sent successfully, then the jcw
comment CMCM1T1 = 1
comment    M1 designates 1st message for this execution
comment      T1 designates 1st To: recipient for this message
comment '1' = successful; anything else indicates a problem with this
comment       recipient
comment
if "!save_netmail_mailbox"="*" then
  deletevar netmail_mailbox
 else
  setvar netmail_mailbox "!save_netmail_mailbox"
endif
deletevar save_netmail_mailbox
if "!save_netmail_mailbox_pwd"="*" then
  deletevar netmail_mailbox_pwd
 else
  setvar netmail_mailbox_pwd "!save_netmail_mailbox_pwd"
endif
deletevar save_netmail_mailbox_pwd
continue
purge report,temp > $NULL
reset r
reset htmlrep
if bound(cmcm1t1) then
  if cmcm1t1>0 then
    echo Message Successfully sent
  else
    echo Invalid recipient address(es)
  endif
 else
  echo Problem running NetMail
endif
continue
deletevar _urgflag  > $NULL
continue
deletevar _spoofle  > $NULL
continue
deletevar _sprecs    > $NULL
continue
deletevar _numrcpts  > $NULL
continue
deletevar _spid      > $NULL