Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void SMTPMail()
- {
- str _subject;
- str _bodyText;
- SysEmailParameters parameters = SysEmailParameters::find();
- str _emailTo = "example@domain.com";
- str emailFrom = "example@domain.com";
- SysMailer mailer;
- InteropPermission permission = new InteropPermission(InteropKind::ComInterop);
- ;
- _subject ="Find Attachment";
- _bodyText = "Dear Sir, \n Find the attachment of text file. \n\n With Regards, \n "+curuserid();
- permission.assert();
- permission.objectOnServer();
- mailer = new SysMailer();
- if (_emailTo != "")
- {
- if (parameters.SMTPRelayServerName)
- {
- mailer.SMTPRelayServer(parameters.SMTPRelayServerName,
- parameters.SMTPPortNumber,
- parameters.SMTPUserName,
- SysEmailParameters::password(),
- parameters.NTLM);
- }
- else
- {
- mailer.SMTPRelayServer(parameters.SMTPServerIPAddress,
- parameters.SMTPPortNumber,
- parameters.SMTPUserName,
- SysEmailParameters::password(),
- parameters.NTLM);
- }
- mailer.fromAddress(emailFrom);
- mailer.tos().appendAddress(_emailTo);
- mailer.subject(_subject);
- mailer.htmlBody(_bodyText);
- mailer.attachments().add("\\\\192.168.156.36\\temp\\temp.txt");
- mailer.sendMail();
- info("Mail Has been sent");
- }
- }
- class ITL_Batch_SMTPEmail extends RunBaseBatch
- {
- TransDate fromdate,todate;
- #define.CurrentVersion(1)
- #define.Version1(1)
- #localmacro.CurrentList
- fromdate,
- todate
- #endmacro
- }
- public void run()
- {
- super();
- this.SMTPMail();
- }
- public boolean canGoBatch()
- {
- return true;
- }
- protected boolean canGoBatchJournal()
- {
- return true;
- }
- Object dialog()
- {
- DialogRunbase dialog = super();
- ;
- return dialog;
- }
- public boolean getFromDialog()
- {
- ;
- return true;
- }
- public container pack()
- {
- return [#CurrentVersion,#CurrentList];
- }
- public boolean unpack(container packedClass)
- {
- Version version = RunBase::getVersion(packedClass);
- ;
- switch (version)
- {
- case #CurrentVersion:
- [version,#CurrentList] = packedClass;
- break;
- default:
- return false;
- }
- return true;
- }
- static void main(Args args)
- {
- ITL_Batch_SMTPEmail ITL_Batch_SMTPEmail;
- ;
- ITL_Batch_SMTPEmail = new ITL_Batch_SMTPEmail();
- if(ITL_Batch_SMTPEmail.prompt())
- {
- ITL_Batch_SMTPEmail.run();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement