将响应ID从SendGrid保存到Spring Boot DB

发布于 2025-01-23 21:22:20 字数 127 浏览 4 评论 0 原文

我正在使用SendGrid Mail模板发送邮件,并且正常工作。邮件适当地发送给具有适当身体的接收者。现在,我提出了一个新的要求,即通过使用sendgrid,它为您提供了您发送的每个邮件的事务ID。现在,我必须将其保存在DB中。谁能帮我吗?

I am using the Sendgrid mail template for sending mail, and it is working completely fine. Mail is sent properly to recipients with the proper body. Now I came with a new requirement, which is, By using SendGrid it provides you with a transaction ID of each mail you sent. Now I have to save it in my DB. Can anyone help me with it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

在你怀里撒娇 2025-01-30 21:22:20

当您使用SendGrid API发送邮件时,响应为空,因此您不会返回ID。

但是,您可以做的是为整个请求或每个个性化设置 custom_args 中的任何内容。 custom_args 在每个跟踪事件。因此,您可以生成自己的ID并存储该ID,然后当您从API接收事件时,您将获得该ID为 custom_args ,并且可以将事件归因于原始电子邮件。

我写了一篇有关上,但我在Spring Boot中没有例子。

When you send a mail with the SendGrid API the response is empty, so you don't get an ID back.

However, what you can do is set anything you like in the custom_args for either the entire request or for each personalisation. custom_args are sent back in the parameters for every tracking event. So, you can generate your own ID and store that, then when you receive an event from the API, you will get that ID as the custom_args and can attribute the event to the original email.

I wrote a blog post about how to do this in Ruby on Rails, but I don't have an example in Spring Boot.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文