Does anybody know how to tell SNDSMTPEMM that a email recipient address variable should not be processed? This can be done with the attachments by specifying "*NONE" but neither "*N" nor "*NONE" or blanks work on the email addresses. I have created a command interface and a CL CPP program that will ask for email addresses and *PRI/*CC/*BCC that will be used with the SNDSMTPEMM command. The command interface will list all entries in a user's output queue and send the contents to one (or more) email addresses. Because there can be up to 20 email addresses, I need to be able to process the SNDSMTPEMM command with any number of emails. If I could specify all 20 email address variables and all 10 file attachments in a single command instance that would be best (assuming that the command has some a way to identify which email address to actually process). Right now, I can get around this by expanding the process to run the SNDSMTPEMM command based on the number of email addresses entered. But this will involve copying the command for each set of email addresses - I am trying to find a better solution.
Asked
Active
Viewed 43 times
0
-
Maybe if it had an ILE interface like MAILTOOL you'd have more options. :) But seriously, I don't think you can do what you want. The IBM Email stuff is a pile of bandaids on bandages. – bvstone May 27 '23 at 01:23
1 Answers
0
It sounds like you have written or are writing your own "wrapper" for SNDSMTPEMM, and you want to be able to accept up to 20 recipients and pass them along to SNDSMTPEMM, something like
SNDSMTPEMM RCP((&ADDR1 &TYPE1)
(&ADDR2 &TYPE2)
(&ADDR3 &TYPE3)
...
(&ADDR19 &TYPE19)
(&ADDR20 &TYPE20))
SUBJECT(&SUBJ)
NOTE(&BODY)
And you've defined variables for 20 recipients, and want to always include all the variables in the SNDSMTPEMM command; but of course usually there will be fewer than 20 actual recipients, so you want to know how to tell SNDSMTPEMM to ignore some of the (&ADDRn &TYPEn) variable pairs.
I do not think there is a way to do that. I think you have to pass only the variables that are needed. Probably the best way to achieve what you want is to build the SNDSMTPEMM command dynamically, as a string, and then use QCMDEXC or similar to execute that string as a command.

John Y
- 14,123
- 2
- 48
- 72
-
I tried creating a command string and using QCMDEXC, but ran into a problem when I tried to include attachments. I got an error that "Expression not allowed for parameter ATTACH". When I call the SNDSMTPEMM command directly in the CPP, I cannot provide a varying list of recipients. When I build a command string and use QCMDEXC, I cannot provide a varying list of attachments. I ended up copying the SNDSMTPEMM command 20 times each with an increasing number of recipients and then executed the version that matched the number of recipients in the email address list. Not very elegant, but it works – user3763812 Jun 16 '23 at 16:16
-
I don't understand how it is possible that you can *not* provide a varying list of attachments if you build a command string. I would guess you were not using the right syntax when you were building the command string. Or we are misunderstanding each other when we say "build a command string". – John Y Jun 21 '23 at 03:40