carstein.seeberg

Generating ticket over SMTP using X-Headers

Discussion created by carstein.seeberg on Feb 14, 2009
This came up for a customer the other day, thought I'd share this with the rest of you.
The receiving ticket system depends on X-Header tokens, and this is not provided by the emailgtw.
We can achieve this by using the command-line mail tool blat (http://www.blat.net).  I have installed the blat binary and dll files in my nas/bin directory.

Enjoy,
Carstein

---8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<--

smtp_server = "odin.nimsoft.no"      -- configure your SMTP server
sender      = "emailgtw@nimsoft.no"  -- overrides the default 'sender'

function ticket (recipient,subject,customer,hostname,priority,body)

   if recipient == nil or subject==nil or customer==nil or hostname==nil or priority==nil or body==nil then
      error("Illegal ticket parameters.")
   end

   -- http://www.blat.net/
   mailer = "bin\\blat - -server "..smtp_server.." -f "..sender.." -to "..recipient.." -subject \""..subject.."\" -body \""..body.."\""
   mailer = mailer .. " -x \"X-CUSTOMER: "..customer.."\""
   mailer = mailer .. " -x \"X-HOSTNAME: "..hostname.."\""
   mailer = mailer .. " -x \"X-PRIORITY: "..priority.."\""

   action.command (mailer)
end

ticket ("you@company.com","New Ticket","MyCustomer","MyHost","warning","This is important")


Outcomes