目前,JSL 中的 Mail 功能允許您向有效電子郵件地址列表發送電子郵件,但是,它通過遞增列表並向每個收件人發送單獨的電子郵件來實現。在電子郵件客戶端需要用戶干預以允許 JMP 發送電子郵件的機器上(例如,企業環境中的 Windows 上的 Outlook),這意味著用戶必須坐下來等待每個收件人的警告消息,有時使用內置的-延遲!這是非常低效的,並且意味著使用郵件功能自動向感興趣的利益相關者發送報告需要的時間與手動將報告複製並粘貼到電子郵件中一樣多,甚至更多。
JMP 版本 16.2.0
示例代碼(假設在 temp 文件夾中保存的報告為 png,使用虛擬電子郵件地址):
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>