Skip to content

Instantly share code, notes, and snippets.

@develCuy
Created April 8, 2015 01:24
Show Gist options
  • Save develCuy/5ba06726aea8b6fb9b36 to your computer and use it in GitHub Desktop.
Save develCuy/5ba06726aea8b6fb9b36 to your computer and use it in GitHub Desktop.
fake sendmail / just another null mailer written in Lua and seawolf
#!/usr/bin/env lua5.1
local seawolf = require 'seawolf'.__build('variable', 'behaviour')
local print_r = seawolf.variable.print_r
local temp_dir = seawolf.behaviour.temp_dir
local ts = os.date('%Y-%m-%d %H:%M:%S')
local output = ([[----
-- %s
Arguments: %s
%s]]):format(ts, print_r(arg, 1), io.read '*a')
local fh = io.open(temp_dir() .. '/null_mailer.log', 'a+')
if fh then
fh:write(output)
end
@develCuy
Copy link
Author

develCuy commented Apr 8, 2015

This fake sendmail works as a logger, it reads from STDIN and outputs it to $TMP/null_mailer.log. Nice for debugging!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment