lib/sendgrid_actionmailer.rb in sendgrid-actionmailer-2.0.1 vs lib/sendgrid_actionmailer.rb in sendgrid-actionmailer-2.1.0
- old
+ new
@@ -32,10 +32,11 @@
add_content(sendgrid_mail, mail)
add_send_options(sendgrid_mail, mail)
add_mail_settings(sendgrid_mail, mail)
add_tracking_settings(sendgrid_mail, mail)
+
response = perform_send_request(sendgrid_mail)
settings[:return_response] ? response : self
end
@@ -77,9 +78,13 @@
def to_personalizations(mail)
Personalization.new.tap do |p|
to_emails(mail.to).each { |to| p.add_to(to) }
to_emails(mail.cc).each { |cc| p.add_cc(cc) }
to_emails(mail.bcc).each { |bcc| p.add_bcc(bcc) }
+
+ if mail['dynamic_template_data']
+ p.add_dynamic_template_data(json_parse(mail['dynamic_template_data'].value))
+ end
p.add_substitution(Substitution.new(key: "%asm_group_unsubscribe_raw_url%", value: "<%asm_group_unsubscribe_raw_url%>"))
p.add_substitution(Substitution.new(key: "%asm_global_unsubscribe_raw_url%", value: "<%asm_global_unsubscribe_raw_url%>"))
p.add_substitution(Substitution.new(key: "%asm_preferences_raw_url%", value: "<%asm_preferences_raw_url%>"))
end
end