【问题标题】:How to set reply_to/reply-to using SparkPosts Ruby API client?如何使用 SparkPosts Ruby API 客户端设置 reply_to/reply-to?
【发布时间】:2016-08-10 21:21:40
【问题描述】:

当我使用SparkPost::Client.new().send_message(param1,param2,etc...) 时,我似乎无法在vals 哈希中设置reply_to。例如:https://github.com/SparkPost/ruby-sparkpost

意思是,当我通过客户端发送电子邮件时 - 我希望最终用户(接收电子邮件)自动让reply_to attr(不是from attr)填写回复: 给定 ESP 的字段。

我也见过这个:https://github.com/SparkPost/ruby-sparkpost/blob/master/examples/transmission/with_template.rb。其中使用send_payload

有谁知道如何设置reply_to,这样它就不会简单地默认为from 的电子邮件地址?

【问题讨论】:

    标签: ruby email sparkpost


    【解决方案1】:

    想通了。目前,您必须使用SparkPost::Client.new().transmission.send_payload 方法并自己构建有效负载。

    例子:

    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)
    

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-03-21
    • 1970-01-01
    • 2019-09-22
    • 1970-01-01
    • 1970-01-01
    • 2023-02-03
    • 2017-05-16
    相关资源
    最近更新 更多