I have some simple code that loads email addresses into variables, prints a
report, and emails the report to the variable addresses. If I hard code for
"opunit", I get a single pass - and the report is sent to all three addresses.
If I run the cursor for all values (take out the where clause), emails are only
sent to the first variable address. The second two are ignored. Any thoughts?
declare c1 cursor for select distinct(opunit) from treport +
where opunit = '15511200' order by opunit
open c1
fetch c1 into vspeed vi1
while sqlcode <> 100 then
select empmail1, empmail2, empmail3 into vempn1 indicator viempn1, +
vempn2 indicator viempn2, vempn3 indicator viempn3 from byuemail +
where theopunit = .vspeed
set var vfilename = ('Sig Card Entries' & .vspeed & (ctxt(.vpostdate)))
print rday where opunit = .vspeed option pdf|filename &vfilename.pdf +
|Open OFF +
|Email ON +
|Email_host gateway.byu.edu +
|Email_To_List &vempn1, &vempn2, &vempn3 +
|Email_From_name Glenn Smith +
|Email_From_Address [email protected] +
|Email_Subject &vfilename +
|Email_BCC_List [email protected] +
|Email_Body For Your Review +
|Email_Delete_After_Send OFF +
|Email_Show_Dialog_ OFF
fetch c1 into vspeed vi1, vpostdate vi2
endwhile
drop cursor c1