Page 1 of 1

log file in email directly

Posted: Thu Jun 23, 2011 8:52 pm
by kmcrae
Hi,



how can set my mail send for the log is not in attach file but directly in the text email?

log file in email directly

Posted: Fri Jun 24, 2011 8:53 am
by rzacherl
Hi,



you don't write what "log" exactly means in your context. I assume it's a text file and the incoming job of the "Mail send" flow element. In that case you could use a script expression within the Email text property which makes use of the File class and which reads the contents of the log file and returns it as a String object. This of course makes the use of PowerSwitch necessary.



Regards,



Robert

log file in email directly

Posted: Mon Jun 27, 2011 3:59 pm
by kmcrae
Hi Robert,



my log is come to "madetoprint" element in my flow. I do not know the script expression where I can find a solution?



Regards,



Ken

log file in email directly

Posted: Mon Jun 27, 2011 5:00 pm
by rzacherl
Hi Ken,



a quick and dirty solution would be:



var logFile = new File( job.getPath() );

logFile.open( File.ReadOnly );

var contents = logFile.read();

logFile.close();

contents



Paste these five lines of code into the "Script expression" type property editor of the "Message text" property of your "Mail send" flow element.



Regards,



Robert

log file in email directly

Posted: Mon Jun 27, 2011 5:23 pm
by kmcrae
Hi Robert,



Thank you very much is what I want!



Regards,



Ken