mailer.rb handler doesn't work on my machine

I can use mail command to send mail to my email address. But I can’t use mailer.rb handler to send mails.

I’ve inspect the sensu-server.log file, and find these 2 lines of log are suspicious. But I know nothing about Ruby, so I can’t fix it by my own.

{“timestamp”:“2015-03-09T13:38:43.826418+0800”,“level”:“info”,“message”:“handler output”,“handler”:{“type”:“pipe”,“command”:"/etc/sensu/handlers/mailer.rb -j /etc/sensu/handlers/mailer.json",“name”:“print_timestamp”},“output”:"/etc/sensu/handlers/mailer.rb:78:in handle': undefined method’ for nil:NilClass (NoMethodError)\n"}

{“timestamp”:“2015-03-09T13:38:43.826572+0800”,“level”:“info”,“message”:“handler output”,“handler”:{“type”:“pipe”,“command”:"/etc/sensu/handlers/mailer.rb -j /etc/sensu/handlers/mailer.json",“name”:“print_timestamp”},“output”:"\tfrom /var/lib/gems/1.9.1/gems/sensu-plugin-1.1.0/lib/sensu-handler.rb:55:in `block in class:Handler’\n"}

Here is my version of mailer.json:
{
“mailer”: {
“admin_gui”: “http://admin.example.com:8080/”,
“mail_from”: “neo@matrix.NULL.NULL”,
“mail_to”: "xxx@yyy.com",
“smtp_address”: “localhost”,
“smtp_port”: “25”,
“smtp_domain”: “localhost”
}
}

About the “mail_from” attribute:
When I use mail command send emails, the sender address displayed in the email which I recieved is “neo@matrix.NULL.NULL”, so I use that as a “mail_from” value. Don’t know whether it’ ok or not.

It seems that SMTP works fine on my machine, I’ve checked it use this command: “telnet localhost 25”. It gives the following result:
Trying 127.0.0.1…
Connected to localhost.
Escape character is ‘^]’.
220 matrix ESMTP Postfix (Ubuntu)

-j does not expect a file path

···

On Monday, 9 March 2015 17:13:51 UTC+11, Timothy John wrote:

I can use mail command to send mail to my email address. But I can’t use mailer.rb handler to send mails.

I’ve inspect the sensu-server.log file, and find these 2 lines of log are suspicious. But I know nothing about Ruby, so I can’t fix it by my own.
{“timestamp”:“2015-03-09T13:38:43.826418+0800”,“level”:"
info",“message”:“handler output”,“handler”:{“type”:“pipe”,“command”:“/etc/sensu/ handlers/mailer.rb -j /etc/sensu/handlers/mailer.json”,“name”:“print_timestamp”},“output”:“/etc/sensu/ handlers/mailer.rb:78:in handle': undefined method ’ for nil:NilClass (NoMethodError)\n”}
{“timestamp”:“2015-03-09T13:38:43.826572+0800”,“level”:"
info",“message”:“handler output”,“handler”:{“type”:“pipe”,“command”:“/etc/sensu/ handlers/mailer.rb -j /etc/sensu/handlers/mailer.json”,“name”:“print_timestamp” },“output”:“\tfrom /var/lib/gems/1.9.1/gems/sensu-plugin-1.1.0/lib/sensu-handler.rb:55:in `block in class:Handler’\n”}

Here is my version of mailer.json:
{
“mailer”: {
“admin_gui”: “http://admin.example.com:8080/”,
“mail_from”: “neo@matrix.NULL.NULL”,
“mail_to”: “x...@yyy.com”,
“smtp_address”: “localhost”,
“smtp_port”: “25”,
“smtp_domain”: “localhost”
}
}

About the “mail_from” attribute:
When I use mail command send emails, the sender address displayed in the email which I recieved is “neo@matrix.NULL.NULL”, so I use that as a “mail_from” value. Don’t know whether it’ ok or not.

It seems that SMTP works fine on my machine, I’ve checked it use this command: “telnet localhost 25”. It gives the following result:
Trying 127.0.0.1…
Connected to localhost.
Escape character is ‘^]’.
220 matrix ESMTP Postfix (Ubuntu)