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!

Brandon West
As Director of Developer Relations for SendGrid, Brandon's focus is on empowering developers to build things, gathering feedback for new features and improvements, and fostering a cooperative developer community for anything that needs email integration.