2

It seems like I can't set reply_to in vals hash when I'm using SparkPost::Client.new().send_message(param1,param2,etc...). Egs here: https://github.com/SparkPost/ruby-sparkpost

Meaning, when I send an email through the client - I want the end-user (that receives the email) to automatically have the reply_to attr (NOT the from attr) fill out the Reply To: field for a given ESP.

I've also seen this: https://github.com/SparkPost/ruby-sparkpost/blob/master/examples/transmission/with_template.rb. Which uses send_payload.

Does anyone know how to set the reply_toso it doesn't simply default to the from's email address?

The Dembinski
  • 1,469
  • 1
  • 15
  • 24

1 Answers1

2

Figured it out. Currently, you must use the SparkPost::Client.new().transmission.send_payload method and build the payload yourself.

Example:

payload = {
  recipients: [{tags:[tag1,tag2],address:{email:foo@bar.com}}],
  content: {
    from: "Someone <no-reply@somewhere.io>",
    subject: "Your awesome subject",
    reply_to: "Someone Else <totally.hit.me.up@somewhere.else.io>",
    html:"<h1>Hello World</h1>"
  }
}
SparkPost::Client.new().transmission.send_payload(payload)
The Dembinski
  • 1,469
  • 1
  • 15
  • 24
  • 1
    Not sure if you use templates, but you can also set the reply_to on a template. This isn't supported by the SparkPost UI yet, but you can update it with the API: https://developers.sparkpost.com/api/#/reference/templates – cfs Apr 19 '16 at 15:35