Over on his blog The Pug Automatic, Henrik Nyh has published a great tutorial on using categories and unique arguments to add metadata to your messages in Rails, which you can then see data in the email activity log or on in event API posts.

Henrik’s example adds the following metadata:

  • A category with the name of the mailer, e.g. “MyMailer”
  • A category with the mailer and action, e.g. “MyMailer#hello”
  • A unique argument with the Rails environment, e.g. “production”
  • A unique argument with the arguments passed into the mailer as a hash from argument name to value, like “{:foo_id=>123, :bar_id=>456}”

Thanks for sharing your experience, Henrik!

SendGrid Team
Expert advice and insight about all things email including best practices tips, examples, and advice for marketers, developers, and everyone in between.