1、生成文件。
1 Args args; 2 ReportRun reportRun; 3 System.Exception ex; 4 str reportname = reportstr(PriceDiscTable_Purch_Expiration); 5 str AttachmentPath = "\\\\xxxx004\\MailAttachment\\PriceDiscTable_Purch_Expiration.PDF"; 6 //通过Batch生成文件要用相对路径的共享文件夹 7 ; 8 9 args = new args(); 10 args.name(reportname); 11 reportRun = new reportRun(args); 12 reportRun.query().interactive(False); 13 reportRun.report().interactive(False); 14 reportRun.setTarget(printMedium::File); 15 reportRun.printJobSettings().setTarget(PrintMedium::File); 16 reportRun.printJobSettings().preferredTarget(PrintMedium::File); 17 reportRun.printJobSettings().format(PrintFormat::PDF); 18 reportRun.printJobSettings().warnIfFileExists(False); 19 reportRun.printJobSettings().suppressScalingMessage(True); 20 reportRun.printJobSettings().packPrintJobSettings(); 21 reportRun.printJobSettings().fileName(AttachmentPath); 22 reportRun.run();
2、发送邮件。
1 SysEmailBatch mailer = SysEMailBatch::construct(); 2 ; 3 4 mailer.parmPriority(emailPriority::High); 5 mailer.parmSenderAddr("xxxx@xxxx.com.cn"); 6 mailer.parmEmailAddr("xxxx@xxxx.com.cn"); 7 mailer.parmMessageBody("Jinn test send mail!"); 8 mailer.parmSubject('Jinn test mail'); 9 mailer.addAttachmentfileName("\\\\xxxx004\\MailAttachment\\PurchPriceExp.PDF"); 10 mailer.run();
3、相关设置。
(1)邮件服务器设置。
(2)AOS打印配置。