|
SoftTree Technologies
Technical Support Forums
|
|
Author |
Message |
ht2019
Joined: 07 Feb 2019 Posts: 7 Country: Norway |
|
How to get a filename into a variable |
|
I have files With YearWeek in the filenames, the files I want to send as attachment in a mail.
how do I create the variable With the folder and filename (C:\test\send\filename_201906.txt)
|
|
Thu Feb 07, 2019 3:43 pm |
|
|
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7904
|
|
|
|
I'm sorry, I don't quite understand your question. What kind of trigger do you use for the job? Is that a file trigger? If yes, you can use the macro variable @V"file". You don't need to create anything, the macro-variable is always available. Just reference it in the job code or job properties where you need the value.
Last edited by SysOp on Wed Mar 13, 2019 10:12 am; edited 1 time in total |
|
Mon Mar 11, 2019 12:04 am |
|
|
ht2019
Joined: 07 Feb 2019 Posts: 7 Country: Norway |
|
|
|
|
|
I'm sorry, I don't quite understand your question. What kind of trigger do you use for the job. Is that a file trigger/ If yes, you can use the macro variable @V"file". You don't need to create anything, the macro-variable is always available. Just reference it in the job code or job properties where you need the value. |
when I use this Mail.send...... I get an error - IOExeption while sending message.
when I use the - \\\\bcdomail\\test\\uke_201901.xls, the file is send with thw message.
Mail.sendWithAttachment("operator@test.no", "bcbcbcbc",
"operator@test.no,hans@test.no", "FK fil fra TEST",
"fil vedlagt", '@V"files"');
|
|
Wed Mar 13, 2019 6:14 am |
|
|
ht2019
Joined: 07 Feb 2019 Posts: 7 Country: Norway |
|
|
|
|
|
|
|
I'm sorry, I don't quite understand your question. What kind of trigger do you use for the job. Is that a file trigger/ If yes, you can use the macro variable @V"file". You don't need to create anything, the macro-variable is always available. Just reference it in the job code or job properties where you need the value. |
when I use this Mail.send...... I get an error - IOExeption while sending message.
when I use the - \\\\bcdomail\\test\\uke_201901.xls, the file is send with thw message.
Mail.sendWithAttachment("operator@test.no", "bcbcbcbc",
"operator@test.no,hans@test.no", "FK fil fra TEST",
"fil vedlagt", '@V"files"'); |
"After a long search I found out that the fix was provided in one of the earlier versions but then lost. This a regression bug." from sysop
found this from 2006.01.26, is this then still a problem?
|
|
Wed Mar 13, 2019 8:16 am |
|
|
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7904
|
|
|
|
Could you please point me to the reference you have found? That would help me to locate the fix or a solution for the issue.
|
|
Wed Mar 13, 2019 10:13 am |
|
|
ht2019
Joined: 07 Feb 2019 Posts: 7 Country: Norway |
|
|
Thu Mar 14, 2019 6:03 am |
|
|
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7904
|
|
|
|
Thank you very much. I verified that issue and as far as I can tell it's relevant to 24x7 version 3.x code branch only, and not applicable to more recent versions.
1. Please enable the tracing in the scheduler (Tools / Options menu Log tab, Trace Enabled option)
2. VERY IMPORTANT: Make sure the job property detached is not set, or @V"files" may not work correctly.
3. In the very beginning of the job script, please add the following line
Scheduler.logAddMessage( 'INFO', @V"job_id", '@V"job_name"', '@V"file"');
4. Let the job run on it's own, don't use Run Now as it would bypass the job trigger that caches names of files that triggered the job.
5. Copy here the complete contents of the job output (latest run on the Output tab), either a screenshot or copy text of the output. You can mask emails or other sensitive info, but please don't 5. mask file names as that part might be the most important.
If you don't see the output produced, please open c:\24x7\debug.log file in noted, search it for "Scheduler.logAddMessage" and post here what you find in the log above and below that line
|
|
Thu Mar 14, 2019 9:55 am |
|
|
ht2019
Joined: 07 Feb 2019 Posts: 7 Country: Norway |
|
|
|
|
|
Thank you very much. I verified that issue and as far as I can tell it's relevant to 24x7 version 3.x code branch only, and not applicable to more recent versions.
1. Please enable the tracing in the scheduler (Tools / Options menu Log tab, Trace Enabled option)
2. VERY IMPORTANT: Make sure the job property detached is not set, or @V"files" may not work correctly.
3. In the very beginning of the job script, please add the following line
Scheduler.logAddMessage( 'INFO', @V"job_id", '@V"job_name"', '@V"file"');
4. Let the job run on it's own, don't use Run Now as it would bypass the job trigger that caches names of files that triggered the job.
5. Copy here the complete contents of the job output (latest run on the Output tab), either a screenshot or copy text of the output. You can mask emails or other sensitive info, but please don't 5. mask file names as that part might be the most important.
If you don't see the output produced, please open c:\24x7\debug.log file in noted, search it for "Scheduler.logAddMessage" and post here what you find in the log above and below that line |
2019-03-14 16:03:43,558 [AWT-EventQueue-0] DEBUG com.softtreetech.jscheduler.db.JobDbImpl - updateJob(JobProperties) : start
2019-03-14 16:03:43,558 [AWT-EventQueue-0] DEBUG com.softtreetech.jscheduler.db.drivers.file.FileJobDbStorage - update(...) : start
2019-03-14 16:03:43,558 [AWT-EventQueue-0] DEBUG com.softtreetech.jscheduler.db.drivers.file.FileJobDbStorage - update(...) : end
2019-03-14 16:03:43,558 [AWT-EventQueue-0] DEBUG com.softtreetech.jscheduler.db.JobDbImpl - updateJob(JobProperties) : end
2019-03-14 16:03:44,984 [AWT-EventQueue-0] DEBUG com.softtreetech.jscheduler.db.drivers.file.FileJobDbStorage - save() : start
2019-03-14 16:03:44,984 [AWT-EventQueue-0] DEBUG com.softtreetech.jscheduler.db.drivers.file.FileJobDbStorage - isRequirePurge(): totalRecordsNumber: 16
2019-03-14 16:03:44,984 [AWT-EventQueue-0] DEBUG com.softtreetech.jscheduler.db.drivers.file.FileJobDbStorage - isRequirePurge(): deletedRecordsNumber: 0
2019-03-14 16:03:44,984 [AWT-EventQueue-0] DEBUG com.softtreetech.jscheduler.db.drivers.file.FileJobDbStorage - isRequirePurge(): result: false
2019-03-14 16:03:44,984 [AWT-EventQueue-0] DEBUG com.softtreetech.jscheduler.db.drivers.file.FileJobDbStorage - save() : total modifications : 1
2019-03-14 16:03:44,984 [AWT-EventQueue-0] DEBUG com.softtreetech.jscheduler.db.drivers.file.FileJobDbStorage - save() : update record ID 20
2019-03-14 16:03:44,984 [AWT-EventQueue-0] DEBUG com.softtreetech.jscheduler.db.drivers.file.FileJobDbStorage - updateFileRecord(...) : start
2019-03-14 16:03:44,984 [AWT-EventQueue-0] DEBUG com.softtreetech.jscheduler.db.drivers.file.FileJobDbStorage - updateFileRecord(...) : end
2019-03-14 16:03:44,984 [AWT-EventQueue-0] DEBUG com.softtreetech.jscheduler.db.drivers.file.FileJobDbStorage - save() : end
2019-03-14 16:04:43,578 [Thread-14] DEBUG com.softtreetech.jscheduler.business.log.SysLogAdapter - Syslog: invoked
2019-03-14 16:04:43,578 [Thread-14] DEBUG com.softtreetech.jscheduler.business.log.EventLogAdapter - WindowsEventLog: invoked
2019-03-14 16:04:43,610 [Thread-14] DEBUG com.softtreetech.jscheduler.business.queue.JobQueue - QUEUE_UNLOCKED
2019-03-14 16:04:43,641 [Job #20 - Send Epost VB @V] DEBUG com.softtreetech.jscheduler.business.log.SysLogAdapter - Syslog: invoked
2019-03-14 16:04:43,641 [Job #20 - Send Epost VB @V] DEBUG com.softtreetech.jscheduler.business.log.EventLogAdapter - WindowsEventLog: invoked
2019-03-14 16:04:43,657 [Job #20 - Send Epost VB @V] DEBUG com.softtreetech.jscheduler.business.Mailer - mail.smtp.auth=true
2019-03-14 16:04:43,657 [Job #20 - Send Epost VB @V] DEBUG com.softtreetech.jscheduler.business.Mailer - mail protocol=SMTP/TLS
2019-03-14 16:04:43,657 [Job #20 - Send Epost VB @V] DEBUG com.softtreetech.jscheduler.business.Mailer - sendEmailImpl(): Date: Thu, 14 Mar 2019 16:04:43 +0100 (CET)
2019-03-14 16:04:43,657 [Job #20 - Send Epost VB @V] DEBUG com.softtreetech.jscheduler.business.Mailer - sendEmailImpl(): From: operatormasked-domain.no
2019-03-14 16:04:43,657 [Job #20 - Send Epost VB @V] DEBUG com.softtreetech.jscheduler.business.Mailer - sendEmailImpl(): To: hansmasked-domain.no
2019-03-14 16:04:43,657 [Job #20 - Send Epost VB @V] DEBUG com.softtreetech.jscheduler.business.Mailer - sendEmailImpl(): Subject: Message from 24x7 Scheduler - job "Send Epost VB @V" event
2019-03-14 16:04:43,657 [Job #20 - Send Epost VB @V] DEBUG com.softtreetech.jscheduler.business.Mailer - sendEmailImpl(): X-Mailer: 24x7 Scheduler
2019-03-14 16:04:44,716 [Job #20 - Send Epost VB @V] DEBUG com.softtreetech.jscheduler.business.Mailer - sendEmailImpl - mail sent
2019-03-14 16:04:44,747 [Job #20 - Send Epost VB @V] DEBUG com.softtreetech.jscheduler.business.log.SysLogAdapter - Syslog: invoked
2019-03-14 16:04:44,747 [Job #20 - Send Epost VB @V] DEBUG com.softtreetech.jscheduler.business.log.EventLogAdapter - WindowsEventLog: invoked
2019-03-14 16:04:44,763 [Job #20 - Send Epost VB @V] DEBUG com.softtreetech.jscheduler.business.runner.JavaScriptJobRunner - runJob(): script: Scheduler.logAddMessage('INFO','20','Send Epost VB @V','\\192.168.10.36\ftp\Varekatalog\Send\test\uke_201999_med.XLS');
Mail.sendWithAttachment("operatormasked-domain.no", "bcbcbc", "operatormasked-domain.no,hansmasked-domain.no", "FK fil fra BCTEST", "fil vedlagt", '[ERROR]');
2019-03-14 16:04:44,763 [Job #20 - Send Epost VB @V] DEBUG com.softtreetech.jscheduler.business.runner.JavaScriptJobRunner - runJob(): starting JavaScript
2019-03-14 16:04:44,763 [Job #20 - Send Epost VB @V] DEBUG com.softtreetech.jscheduler.business.runner.JavaScriptJobRunner - runJob(): job not using user authentication
2019-03-14 16:04:44,763 [Job #20 - Send Epost VB @V] DEBUG com.softtreetech.jscheduler.business.runner.javascript.JavaScriptThreadImpl - evaluateScript(): starting jsthread
2019-03-14 16:04:44,763 [Job #20 - Send Epost VB @V] DEBUG com.softtreetech.jscheduler.business.runner.javascript.JavaScriptThreadImpl - evaluateScript(): waiting
2019-03-14 16:04:44,778 [JavaScript] DEBUG com.softtreetech.jscheduler.business.runner.javascript.JavaScriptThreadImpl - jsthread started
2019-03-14 16:04:44,778 [JavaScript] DEBUG com.softtreetech.jscheduler.business.runner.javascript.JavaScriptRunner - runScript: JavaScriptRunner
2019-03-14 16:04:44,778 [JavaScript] DEBUG com.softtreetech.jscheduler.business.remotecontrol.RemoteOperationsImpl - sourceID 20
2019-03-14 16:04:44,778 [JavaScript] DEBUG com.softtreetech.jscheduler.business.remotecontrol.RemoteOperationsImpl - Type 2
2019-03-14 16:04:44,778 [JavaScript] DEBUG com.softtreetech.jscheduler.business.remotecontrol.RemoteOperationsImpl - job Send Epost VB @V
2019-03-14 16:04:44,778 [JavaScript] DEBUG com.softtreetech.jscheduler.business.remotecontrol.RemoteOperationsImpl - Log record Thu Mar 14 16:04:44 CET 2019, 7xScmRht5hhVbDPyGb3xspoWOaY=, 2, 20, Send Epost VB @V, \192.168.10.36tpVarekatalogSend estuke_201999_med.XLS
2019-03-14 16:04:44,809 [JavaScript] DEBUG com.softtreetech.jscheduler.business.log.SysLogAdapter - Syslog: invoked
2019-03-14 16:04:44,809 [JavaScript] DEBUG com.softtreetech.jscheduler.business.log.EventLogAdapter - WindowsEventLog: invoked
2019-03-14 16:04:44,825 [JavaScript] DEBUG com.softtreetech.jscheduler.business.runner.javascript.JavaScriptRunner - Mail.sendWithAttachment()
2019-03-14 16:04:44,825 [JavaScript] DEBUG com.softtreetech.jscheduler.business.runner.javascript.JavaScriptRunner - Loading mailer
2019-03-14 16:04:44,825 [JavaScript] DEBUG com.softtreetech.jscheduler.business.runner.javascript.JavaScriptRunner - mailer.sendEmail()
2019-03-14 16:04:44,825 [JavaScript] DEBUG com.softtreetech.jscheduler.business.Mailer - mail.smtp.auth=true
2019-03-14 16:04:44,825 [JavaScript] DEBUG com.softtreetech.jscheduler.business.Mailer - mail protocol=SMTP/TLS
2019-03-14 16:04:44,825 [JavaScript] DEBUG com.softtreetech.jscheduler.business.Mailer - sendEmailImpl - file 1: [ERROR]
2019-03-14 16:04:44,825 [JavaScript] DEBUG com.softtreetech.jscheduler.business.Mailer - sendEmailImpl(): Date: Thu, 14 Mar 2019 16:04:44 +0100 (CET)
2019-03-14 16:04:44,825 [JavaScript] DEBUG com.softtreetech.jscheduler.business.Mailer - sendEmailImpl(): From: operatormasked-domain.no
2019-03-14 16:04:44,825 [JavaScript] DEBUG com.softtreetech.jscheduler.business.Mailer - sendEmailImpl(): To: operatormasked-domain.no, hansmasked-domain.no
2019-03-14 16:04:44,825 [JavaScript] DEBUG com.softtreetech.jscheduler.business.Mailer - sendEmailImpl(): Subject: FK fil fra BCTEST
2019-03-14 16:04:44,825 [JavaScript] DEBUG com.softtreetech.jscheduler.business.Mailer - sendEmailImpl(): X-Mailer: 24x7 Scheduler
2019-03-14 16:04:45,356 [JavaScript] DEBUG com.softtreetech.jscheduler.business.Mailer - sendEmailImpl
javax.mail.MessagingException: IOException while sending message;
nested exception is:
java.io.FileNotFoundException: [ERROR] (The system cannot find the file specified)
at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1182)
at javax.mail.Transport.send0(Transport.java:254)
at javax.mail.Transport.send(Transport.java:124)
at com.softtreetech.jscheduler.business.Mailer.sendEmailImpl(Unknown Source)
at com.softtreetech.jscheduler.business.Mailer.sendEmail(Unknown Source)
at com.softtreetech.jscheduler.business.runner.javascript.JavaScriptRunner$Mail.sendWithAttachment(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:174)
at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:197)
at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:3026)
at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2164)
at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:140)
at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:304)
at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2769)
at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2145)
at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:140)
at org.mozilla.javascript.InterpretedFunction.exec(InterpretedFunction.java:149)
at org.mozilla.javascript.Context.evaluateReader(Context.java:1251)
at com.softtreetech.jscheduler.business.runner.javascript.JavaScriptRunner.runScript(Unknown Source)
at com.softtreetech.jscheduler.business.runner.javascript.JavaScriptThreadImpl.run(Unknown Source)
Caused by: java.io.FileNotFoundException: [ERROR] (The system cannot find the file specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:138)
at javax.activation.FileDataSource.getInputStream(FileDataSource.java:97)
at javax.activation.DataHandler.writeTo(DataHandler.java:305)
at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1593)
at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:948)
at javax.mail.internet.MimeMultipart.writeTo(MimeMultipart.java:538)
at com.sun.mail.handlers.multipart_mixed.writeTo(multipart_mixed.java:103)
at javax.activation.ObjectDataContentHandler.writeTo(DataHandler.java:884)
at javax.activation.DataHandler.writeTo(DataHandler.java:317)
at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1593)
at javax.mail.internet.MimeMessage.writeTo(MimeMessage.java:1839)
at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1134)
... 22 more
2019-03-14 16:04:45,356 [JavaScript] DEBUG com.softtreetech.jscheduler.business.runner.javascript.JavaScriptThreadImpl - org.mozilla.javascript.WrappedException: Wrapped com.softtreetech.jscheduler.common.SchedException: IOException while sending message
2019-03-14 16:04:45,356 [JavaScript] DEBUG com.softtreetech.jscheduler.business.runner.javascript.JavaScriptThreadImpl - jsthread stopped
2019-03-14 16:04:45,356 [Job #20 - Send Epost VB @V] DEBUG com.softtreetech.jscheduler.business.runner.javascript.JavaScriptThreadImpl - evaluateScript(): script terminated with exception: org.mozilla.javascript.WrappedException: Wrapped com.softtreetech.jscheduler.common.SchedException: IOException while sending message
2019-03-14 16:04:45,356 [Job #20 - Send Epost VB @V] DEBUG com.softtreetech.jscheduler.business.runner.javascript.JavaScriptThreadImpl - evaluateScript(): rethrow instanceOf RhinoException
2019-03-14 16:04:45,356 [Job #20 - Send Epost VB @V] DEBUG com.softtreetech.jscheduler.business.runner.JavaScriptJobRunner - runJob(): wrapped exception: org.mozilla.javascript.WrappedException: Wrapped com.softtreetech.jscheduler.common.SchedException: IOException while sending message
2019-03-14 16:04:45,356 [Job #20 - Send Epost VB @V] DEBUG com.softtreetech.jscheduler.business.runner.JavaScriptJobRunner - runJob(): stopping local js thread
2019-03-14 16:04:45,356 [Job #20 - Send Epost VB @V] DEBUG com.softtreetech.jscheduler.business.runner.javascript.JavaScriptThreadImpl - stopJScript()
2019-03-14 16:04:45,356 [Job #20 - Send Epost VB @V] DEBUG com.softtreetech.jscheduler.business.runner.JavaScriptJobRunner - runJob(): job finished
2019-03-14 16:04:45,388 [Job #20 - Send Epost VB @V] DEBUG com.softtreetech.jscheduler.business.log.SysLogAdapter - Syslog: invoked
2019-03-14 16:04:45,388 [Job #20 - Send Epost VB @V] DEBUG com.softtreetech.jscheduler.business.log.EventLogAdapter - WindowsEventLog: invoked
2019-03-14 16:04:45,403 [Job #20 - Send Epost VB @V] DEBUG com.softtreetech.jscheduler.business.event.JobSchedulerImpl - disableJob(...) : Job with id [20] is removed.
2019-03-14 16:04:45,419 [Job #20 - Send Epost VB @V] DEBUG com.softtreetech.jscheduler.db.JobDbImpl - updateJob(JobProperties) : start
2019-03-14 16:04:45,419 [Job #20 - Send Epost VB @V] DEBUG com.softtreetech.jscheduler.db.drivers.file.FileJobDbStorage - update(...) : start
2019-03-14 16:04:45,419 [Job #20 - Send Epost VB @V] DEBUG com.softtreetech.jscheduler.db.drivers.file.FileJobDbStorage - update(...) : end
2019-03-14 16:04:45,419 [Job #20 - Send Epost VB @V] DEBUG com.softtreetech.jscheduler.db.JobDbImpl - updateJob(JobProperties) : end
2019-03-14 16:04:45,419 [Job #20 - Send Epost VB @V] DEBUG com.softtreetech.jscheduler.business.log.SysLogAdapter - Syslog: invoked
2019-03-14 16:04:45,419 [Job #20 - Send Epost VB @V] DEBUG com.softtreetech.jscheduler.business.log.EventLogAdapter - WindowsEventLog: invoked
2019-03-14 16:04:45,434 [Job #20 - Send Epost VB @V] DEBUG com.softtreetech.jscheduler.business.Mailer - mail.smtp.auth=true
2019-03-14 16:04:45,434 [Job #20 - Send Epost VB @V] DEBUG com.softtreetech.jscheduler.business.Mailer - mail protocol=SMTP/TLS
2019-03-14 16:04:45,434 [Job #20 - Send Epost VB @V] DEBUG com.softtreetech.jscheduler.business.Mailer - sendEmailImpl(): Date: Thu, 14 Mar 2019 16:04:45 +0100 (CET)
2019-03-14 16:04:45,434 [Job #20 - Send Epost VB @V] DEBUG com.softtreetech.jscheduler.business.Mailer - sendEmailImpl(): From: operatormasked-domain.no
2019-03-14 16:04:45,434 [Job #20 - Send Epost VB @V] DEBUG com.softtreetech.jscheduler.business.Mailer - sendEmailImpl(): To: hansmasked-domain.no
2019-03-14 16:04:45,434 [Job #20 - Send Epost VB @V] DEBUG com.softtreetech.jscheduler.business.Mailer - sendEmailImpl(): Subject: Message from 24x7 Scheduler - job "Send Epost VB @V" event
2019-03-14 16:04:45,434 [Job #20 - Send Epost VB @V] DEBUG com.softtreetech.jscheduler.business.Mailer - sendEmailImpl(): X-Mailer: 24x7 Scheduler
2019-03-14 16:04:46,273 [Job #20 - Send Epost VB @V] DEBUG com.softtreetech.jscheduler.business.Mailer - sendEmailImpl - mail sent
2019-03-14 16:04:46,289 [Job #20 - Send Epost VB @V] DEBUG com.softtreetech.jscheduler.business.log.SysLogAdapter - Syslog: invoked
2019-03-14 16:04:46,289 [Job #20 - Send Epost VB @V] DEBUG com.softtreetech.jscheduler.business.log.EventLogAdapter - WindowsEventLog: invoked
2019-03-14 16:04:46,320 [Job #20 - Send Epost VB @V] DEBUG com.softtreetech.jscheduler.business.queue.JobQueue - QUEUE_UNLOCKED
2019-03-14 16:04:46,398 [Job #20 - Send Epost VB @V] ERROR com.softtreetech.jscheduler.business.runner.JobExecutorImpl - Job errors: An error occurred while executing automation script: Line 2: IOException while sending message
|
|
Thu Mar 14, 2019 6:08 pm |
|
|
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7904
|
|
|
|
I removed domain name from the log to prevent spammers from finding your email and spamming you
In the log I see two important things
Scheduler.logAddMessage('INFO','20','Send Epost VB @V','\\192.168.10.36\ftp\Varekatalog\Send\test\uke_201999_med.XLS');
Mail.sendWithAttachment("operatormasked-domain.no", "bcbcbc", "operatormasked-domain.no,hansmasked-domain.no", "FK fil fra BCTEST", "fil vedlagt", '[ERROR]');
The first line shows an issue with backslashes. The value inserted by @V"file" macro isn't compatible with JavaScript if used as as on a Windows system.
The second line is incorrect too, very likely instead of '@V"file"' you entered something else that is not a valid macro variable name, leading to '[ERROR]' and consequently to an exception in Mail.send... java.io.FileNotFoundException: [ERROR] (The system cannot find the file specified) it's looking for a file named [ERROR]
Here is how the issue can be resolved
var fileList = Directory.dir( '\\\\192.168.10.36\\ftp\\Varekatalog\\Send\\test\\uke_*_med.XLS' );
Mail.sendWithAttachment( 'operatormasked-domain.no', 'bcbcbc', 'operatormasked-domain.no,hansmasked-domain.no', 'FK fil fra BCTEST', 'fil vedlagt', fileList );
|
|
Fri Mar 15, 2019 8:36 am |
|
|
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7904
|
|
|
|
Actually, I would use the following version to ensure the job doesn't send repeating emails and doesn't send emails without attachments if there are somehow several job instances already queued
|
|
var fileName = Directory.dir( '\\\\192.168.10.36\\ftp\\Varekatalog\\Send\\test\\uke_*_med.XLS' );
// if found the required file
if fileName != '' {
// send email
fileName = '\\\\192.168.10.36\\ftp\\Varekatalog\\Send\\test\\' + fileName;
Mail.sendWithAttachment( 'operatormasked-domain.no', 'bcbcbc', 'operatormasked-domain.no,hansmasked-domain.no', 'FK fil fra BCTEST', 'fil vedlagt', fileName );
// rename sent file to ensure it's not picked up again
File.move( fileName, fileName + '.processed' );
} |
|
|
Fri Mar 15, 2019 8:46 am |
|
|
ht2019
Joined: 07 Feb 2019 Posts: 7 Country: Norway |
|
|
|
|
|
Actually, I would use the following version to ensure the job doesn't send repeating emails and doesn't send emails without attachments if there are somehow several job instances already queued
|
|
var fileName = Directory.dir( '\\\\192.168.10.36\\ftp\\Varekatalog\\Send\\test\\uke_*_med.XLS' );
// if found the required file
if fileName != '' {
// send email
fileName = '\\\\192.168.10.36\\ftp\\Varekatalog\\Send\\test\\' + fileName;
Mail.sendWithAttachment( 'operatormasked-domain.no', 'bcbcbc', 'operatormasked-domain.no,hansmasked-domain.no', 'FK fil fra BCTEST', 'fil vedlagt', fileName );
// rename sent file to ensure it's not picked up again
File.move( fileName, fileName + '.processed' );
} |
|
Thanks, should I use JAL or JavaScript? I had to ask so I could test in the weekend
on line 3 I get missing ( before condition (if fileName != '' {)
|
|
Fri Mar 15, 2019 10:53 am |
|
|
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7904
|
|
|
|
Please use JavaScript. The code sample above is for JavaScript.
|
|
Fri Mar 15, 2019 12:48 pm |
|
|
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7904
|
|
|
|
Apologies for line 3, I made an error when pasting the text, replaced too much.
Line 3 should be changed to
|
|
if (fileName != '') { |
|
|
Fri Mar 15, 2019 12:50 pm |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|