weixin_39886619
2020-12-08 18:55 阅读 1

Reply To

I can't find a single example of how to customize a Reply-To header with this library. Can you please point me in the right direction?

Currently trying something like this...


  let mail = new helper.Mail(
      new helper.Email(this.from),
      this.subject,
      new helper.Email(this.to),
      new helper.Content('text/html', this.content),
      new helper.Header('Reply-To', this.to)
    );

该提问来源于开源项目:sendgrid/sendgrid-nodejs

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

4条回答 默认 最新

  • weixin_39886619 weixin_39886619 2020-12-08 18:55

    I think I'm getting closer... I tried this:

    
    mail.personalizations[0].addHeader(new helper.Header('Reply-To', this.to));
    

    Then got an error:

    
                    {
                        "message": "Header can not be one of the reserved keys. Refer to documentation link.",
                        "field": "personalizations.0.headers.Reply-To",
                        "help": "http://sendgrid.com/docs/API_Reference/Web_API_v3/Mail/errors.html#message.personalizations.headers"
                    }
    

    Unfortunately there was nothing very helpful in the documentation it pointed me to.

    点赞 评论 复制链接分享
  • weixin_39661353 weixin_39661353 2020-12-08 18:55

    Hi ,

    Here is an example with reply to. Please let me know if that works for you. Thanks!

    With Best Regards,

    Elmer

    点赞 评论 复制链接分享
  • weixin_39886619 weixin_39886619 2020-12-08 18:55

    Thanks !

    I actually just got it solved using the mail helper as follows...

    
    let mail = new helper.Mail(
          new helper.Email(this.from),
          this.subject,
          new helper.Email(this.to),
          new helper.Content('text/html', this.content)
        );
        mail.setReplyTo(new helper.Email(this.to));
    

    Works for me!

    点赞 评论 复制链接分享
  • weixin_39661353 weixin_39661353 2020-12-08 18:55

    Awesome! Thanks for the follow up!

    点赞 评论 复制链接分享

相关推荐