Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion lib/sendgrid.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class << self
:default_footer_text, :default_spamcheck_score, :default_sg_unique_args
end
attr_accessor :sg_category, :sg_options, :sg_disabled_options, :sg_recipients, :sg_substitutions,
:subscriptiontrack_text, :footer_text, :spamcheck_score, :sg_unique_args, :sg_send_at
:subscriptiontrack_text, :footer_text, :spamcheck_score, :sg_unique_args, :sg_send_at, :sg_batch_id
end

# NOTE: This commented-out approach may be a "safer" option for Rails 3, but it
Expand Down Expand Up @@ -108,6 +108,11 @@ def sendgrid_send_at(utc_timestamp)
@sg_send_at = utc_timestamp
end

# Call within mailer method to set send time for this mail
def sendgrid_batch_id(batch_id)
@sg_batch_id = batch_id
end

# Call within mailer method to set unique args for this email.
# Merged with class-level unique args, if any exist.
def sendgrid_unique_args(unique_args = {})
Expand Down Expand Up @@ -228,6 +233,7 @@ def sendgrid_json_headers(mail)

#Set send_at if set by the user
header_opts[:send_at] = @sg_send_at unless @sg_send_at.blank?
header_opts[:batch_id] = @sg_batch_id unless @sg_batch_id.blank?

# Set multi-recipients
if @sg_recipients && !@sg_recipients.empty?
Expand Down