log file in email directly

Post Reply
kmcrae
Member
Posts: 23
Joined: Wed Feb 23, 2011 2:49 am

log file in email directly

Post by kmcrae »

Hi,



how can set my mail send for the log is not in attach file but directly in the text email?
rzacherl
Member
Posts: 38
Joined: Mon Mar 21, 2011 3:29 pm

log file in email directly

Post 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
kmcrae
Member
Posts: 23
Joined: Wed Feb 23, 2011 2:49 am

log file in email directly

Post 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
rzacherl
Member
Posts: 38
Joined: Mon Mar 21, 2011 3:29 pm

log file in email directly

Post 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
kmcrae
Member
Posts: 23
Joined: Wed Feb 23, 2011 2:49 am

log file in email directly

Post by kmcrae »

Hi Robert,



Thank you very much is what I want!



Regards,



Ken
Post Reply