Replacing EMAIL action in NAS

Discussion created by christopher.harris on Oct 21, 2009
Latest reply on Jun 8, 2016 by ttahkapaa

I've been dealing with ugly emails long enough. When I raise an alert with formatted text (see the attachment) the EMAIL action in the NAS attempts to put the entire Message string in the subject of the email. The newline characters cause part of the message header to be placed in the body of the message rather than the header (see blue circles).

(I've opened a ticket with Nimsoft, but it the problem hasn't been fixed yet.)

To prevent this I've created a lua script I can call from the NAS instead of calling the EMAIL action. All I do is split the message into an array and set the first item in the array as the subject of the email. It works great.

The downside is now I don't get all of the additional information that is specified in the template.txt file and used by the emailgtw to include additional information about the alert.

Now my question - Is there a relatively easy way in Lua to read in a file and then replace all of the placeholders in the file ($whatever) with actual values from an alert?