|
I've been working on a problem for a couple of days and could use some help.
I'm creating a new command called SndEMail which is basically a front-end for
the SndDst command. Within my SndEMail command I allow the user to specify up
10 e-mail recipients and their type (*pri, *cc, or *bcc).
The problem I'm having is taking the e-mail address from my command and making
them work on the SndDst command.
The SndDst command expects to receive the e-mail information in the following
format:
ToIntNet((xx.xxx@xxx *pri)) (xx.xxx@xxx *cc) (xx.xxx@xxx *bcc)), or it
will accept
ToIntNet(('xx.xxx@xxx' '*pri') ('xx.xxx@xxx' '*cc') ('xx.xxx@xxx' '*bcc')).
(notice the apostrophes)
Unfortunately, I cannot figure out how to get the data in either one of the
formats. My information comes out as either:
ToIntNet(('xx.xxx@xxx *pri) (xx.xxx@xxx *cc) (xx.xxx@xxx *bcc')), or
ToIntNet(('xx.xxx@xxx'' ''*pri'') (''xx.xxx@xxx'' ''*cc'') (''xx.xxx@xxx''
''*bcc'')) (notice the double apostrophes).
Thanks is advance for any help - see below for portions of my code.
The source for my command follows: (I have included only the relevant portions)
/****************************************
/* Command Name: SndEMail
/* Description: Send E-mail.
/* CLP: SndEMail
/* Written By: Todd G. Kidwell
/* Date: 08/02/00
/****************************************
/****************************************
/* MOD# DATE INT DESCRIPTION
/* ==== ======== === =================
/*
/****************************************
Cmd Prompt('Send E-mail')
Parm KWd(ToIntNet ) +
Type(ToIntNet ) +
Min(1 ) +
Max(10 ) +
Prompt('Internet Recipient . . . . .')
ToIntNet: +
+
Elem Type(*Char ) +
Len(253 ) +
Expr(*Yes )
Prompt('Internet Address . . . . . .')
Elem Type(*Char ) +
Len(4 ) +
Rstd(*Yes ) +
Dft(*PRI ) +
Values(*PRI +
*CC +
*BCC ) +
Expr(*yes ) +
Prompt('Recipient Type . . . . . . .')
The source for my CL follows (I have include only the relevant portions):
/********************************************************************/
/* Program: SndEMail */
/* Author: Todd G. Kidwell */
/* Date: 08/02/00 */
/* Purpose: Send E-mail. */
/* */
/********************************************************************/
/* Modifications: */
/* */
/* MOD INT DATE REASON */
/* === === ======== ============================================ */
/* */
/********************************************************************/
Pgm Parm(&Subject +
&ToIntNet +
&Message +
&AttchMnt +
&FType +
&SplF +
&SplJob +
&SplNbrN +
&DBFile +
&Doc +
&Folder )
Dcl Var(&Subject ) +
Type(*Char ) +
Len(44 )
Dcl Var(&ToIntNet ) +
Type(*Char ) +
Len(2570 )
Var(&Message ) +
Type(*Char ) +
Len(256 )
Dcl Var(&TmpAddr ) +
Type(*Char ) +
Len(2 )
Dcl Var(&Addr# ) +
Type(*Dec ) +
Len(3 0 )
Dcl Var(&TmpPos ) +
Type(*Dec ) +
Len(5 0 ) +
Value(1 )
Dcl Var(&StartPos ) +
Type(*Dec ) +
Len(6 0 )
Dcl Var(&AddrLen ) +
Type(*Dec ) +
Len(3 0 ) +
Value(253 )
Dcl Var(&TypeLen ) +
Type(*Dec ) +
Len(1 0 ) +
Value(4 )
Dcl Var(&TypePos ) +
Type(*Dec ) +
Len(6 0 )
Dcl Var(&Address ) +
Type(*Char ) +
Len(253 )
Dcl Var(&IntNetAdr ) +
Type(*Char ) +
Len(2600 )
/********************************************************************/
/* Determine number of internet recipients. */
/********************************************************************/
ChgVar Var(&TmpAddr ) +
Value(%sst(&ToIntNet &TmpPos 2))
ChgVar Var(&Addr# ) +
Value(%bin(&TmpAddr))
/********************************************************************/
/* Get starting position of next internet recipient. */
/********************************************************************/
NextAddr:
ChgVar Var(&TmpPos ) +
Value(&TmpPos + 2)
ChgVar Var(&TmpAddr ) +
Value(%sst(&ToIntNet &TmpPos 2))
ChgVar Var(&StartPos ) +
Value(%bin(&TmpAddr) + 3)
/********************************************************************/
/* Get e-mail address and type. */
/********************************************************************/
ChgVar Var(&TypePos ) +
Value(&StartPos + &AddrLen)
ChgVar Var(&Address ) +
Value(%sst(&ToIntNet &StartPos &Addrlen) +
*bcat %sst(&ToIntNet &TypePos +
&TypeLen))
If Cond(&IntNetAdr *eq ' ') +
Then(Do )
ChgVar Var(&IntNetAdr ) +
Value(&Address )
EndDo
Else Cmd(Do )
ChgVar Var(&IntNetAdr ) +
Value(&IntNetAdr *tcat ') (' +
*tcat &Address)
EndDo
ChgVar Var(&Addr# ) +
Value(&Addr# - 1)
If Cond(&Addr# *gt 0) +
Then(Goto +
CmdLbl(NextAddr))
/********************************************************************/
/* Send e-mail with attachments. */
/********************************************************************/
SndDst:
SndDst Type(*Doc ) +
ToIntNet(&IntNetAdr) +
DstD(&Subject ) +
Msg(&Message ) +
Doc(&DocNm ) +
Flr(&DocFlr )
/********************************************************************/
/* Send e-mail. */
/********************************************************************/
SndMsg:
SndDst Type(*LMsg ) +
ToIntNet(&IntNetAdr) +
DstD(&Subject ) +
LongMsg(&Message)
Todd Kidwell (Netstar)
AS/400 System Administrator
(313) 224-0578
+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.