Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

add unique args header

  • Loading branch information...
commit 936ab7697e73ce5bae9c39c9a11f7b8d350e8d8a 1 parent cddd493
@yenif yenif authored
Showing with 10 additions and 0 deletions.
  1. +10 −0 lib/sendgrid.rb
View
10 lib/sendgrid.rb
@@ -128,6 +128,11 @@ def sendgrid_spamcheck_maxscore(score)
@spamcheck_score = score
end
+ # Call within mailer method to set unique args for this email.
+ def sendgrid_unique_args(args)
+ @sg_unique_args = args
+ end
+
# Sets the custom X-SMTPAPI header after creating the email but before delivery
# NOTE: This override is used for Rails 2 ActionMailer classes.
def create!(method_name, *parameters)
@@ -197,6 +202,11 @@ def sendgrid_json_headers(mail)
if !enabled_opts.empty? || (@sg_disabled_options && !@sg_disabled_options.empty?)
header_opts[:filters] = filters_hash_from_options(enabled_opts, @sg_disabled_options)
end
+
+ # Set unique_args
+ if @sg_unique_args && !@sg_unique_args.empty?
+ header_opts[:unique_args] = @sg_unique_args
+ end
header_opts.to_json.gsub(/(["\]}])([,:])(["\[{])/, '\\1\\2 \\3')
end
Please sign in to comment.
Something went wrong with that request. Please try again.