发送邮件(Email)

配置示例

  1. output {
  2. email {
  3. to => "admin@website.com,root@website.com"
  4. cc => "other@website.com"
  5. via => "smtp"
  6. subject => "Warning: %{title}"
  7. options => {
  8. smtpIporHost => "localhost",
  9. port => 25,
  10. domain => 'localhost.localdomain',
  11. userName => nil,
  12. password => nil,
  13. authenticationType => nil, # (plain, login and cram_md5)
  14. starttls => true
  15. }
  16. htmlbody => ""
  17. body => ""
  18. attachments => ["/path/to/filename"]
  19. }
  20. }

解释

outputs/email 插件支持 SMTP 协议和 sendmail 两种方式,通过 via 参数设置。SMTP 方式有较多的 options 参数可配置。sendmail 只能利用本机上的 sendmail 服务来完成 —— 文档上描述了 Mail 库支持的 sendmail 配置参数,但实际代码中没有相关处理,不要被迷惑了。。。