Currently, the Mail function in JSL allows you to send email to a list of valid email addresses, however, it does so by incrementing through the list and sending an individual email to each recipient. On a machine where the email client requires user intervention to allow an email to be sent by JMP (e.g. Outlook on Windows in a corporate environment), this means that the user must sit and await a warning message for each recipient, sometimes with a built-in delay! This is highly inefficient, and means that sending out a report to interested stakeholders requires just as much if not more time when automated using the Mail function as it would to just manually copy and paste the report into an email.
JMP Version 16.2.0
Example code (assumes reports saved in temp folder as pngs, uses dummy email addresses):
sites = {"Site-1", "Site-2"};
report_path = Convert File Path( "$TEMP" );
default_dn = "example.com";
maillist = Associative Array(
sites,
{{// Site-1
"support@example.com", "stakeholder1@example.com", "stakeholder2@example.com", "stakeholder3@example.com"},
{// Site-2
"support@example.com", "stakeholder3@example.com", "vpsales@example.com"}}
);
For( i = 1, i <= N Items( sites ), i++,
site = sites[i];
rep_title = Eval Insert( "^site^_Report" );
temp_file_path = Convert File Path( report_path || "/" || rep_title || ".png" );
winmail = New Window( Eval Insert( "Send ^site^ Email" ),
V List Box(
Lineup Box( N Col( 2 ),
Text Box( "To:" ),
H List Box(
lb_to = List Box( maillist[site], <<NLINES> 0,
newl = lb_to << Get Items;
For( i = N Items( newl ), i > 0, i--,
If( Contains( seli, i ),
Remove From( newl, i )
)
);
lb_to << Set Items( newl );
);
)
)
),
Text Box( "Subject:" ),
teb_subj = Text Edit Box( rep_title ),
Text Box( "Body:" ),
teb_body = Text Edit Box(
Eval Insert( "Hello All,\!N\!tPlease find ^rep_title^ attached.\!N\!N" ),
<<SETNLINES></SETNLINES></NLINES>