SendGridのgemを使っている場合、以下のようなコードを書くことでメールのタイトルをダッシュボード上のカテゴリとして使える。
sendgrid_category :use_subject_lines
しかし、"Category Stats"上では日本語のカテゴリ名が表示されない。
問い合わせたところ、ASCII文字を使うことを強く推奨された。
Categories must be in 7bit encoding using the US-ASCII character set. Even though the categories are passed in your emails, there will be issues when trying to look for them in the stats page. We strongly recommend using ASCII characters for categories.
ということで、代替案としてapp/mailers/application_mailer.rb
あたりに以下を書いて、メソッド名を使うと1つ1つのメーラーにカテゴリ名を書かなくてよくなり便利です。
def sendgrid_category_with_method_name
caller_file_name = caller[0][%r{\/[^\/]+?\.rb\:}][1..-5]
caller_method_name = caller[0][/`.*'/][1..-2]
sendgrid_category "#{caller_file_name}:#{caller_method_name}"
end