Rails、SendGrid - 将邮件守护程序电子邮件转发给用户

发布于 2024-11-14 16:27:10 字数 365 浏览 1 评论 0原文

我有一个应用程序,允许用户向朋友发送邀请。使用 SendGrid 发送电子邮件。我想知道如果用户输入不存在的电子邮件地址,是否可以将邮件守护程序电子邮件转发回给用户。

例如,用户在电子邮件中输入 '[电子邮件受保护]'发送邀请。我希望能够通知用户他们输入的电子邮件不存在。通常,当您刚刚从电子邮件客户端发送电子邮件时,服务器会立即通知您电子邮件无法送达。我想知道是否也可以通过 SendGrid 来做到这一点。

I have an application that allows users to send an invitation to a friend. Emails are being sent out using SendGrid. I am wondering if it's possible to forward the mailer-daemon emails back to the user in an event they type in an email address that doesn't exist.

So for example a user enters in the email '[email protected]' to send the invitation. I want to be able to notify the user that the email they have entered doesn't exist. Usually when you just send an email from an email client the server lets you know right away that the email is not able to be delivered. I am wondering if it's possible to do this as well through SendGrid.

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

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

发布评论

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

评论(1

呆橘 2024-11-21 16:27:10

查看 SendGrid API 的事件通知部分。您可以向应用程序添加一个页面来接受来自 SendGrid 的 POST 请求,然后您将实时收到事件通知。

当退回事件从 SendGrid 发布到该侦听器时,您可以查找需要通过收件人电子邮件通知的用户。如果您的本地存储中没有此关系,则可以在发送时向 SendGrid 传递一个唯一参数,其中包含可用于查找的信息 - 事件通知中包含唯一参数信息。然后,只需采取适当的操作来通知您的用户 - 通过电子邮件或通过您网站上的通知或短信或任何最适合您的应用程序的方式。

这保持了异步通信。当出现问题时,您将收到警报,而无需添加阻止代码,并且您可以向用户发送一条漂亮的品牌消息(当然使用 SendGrid),而不仅仅是转发邮件守护程序响应。

Take a look at the event notification section of the SendGrid API. You can add a page to your application that accepts POST requests from SendGrid, and then you'll get event notifications in real-time.

When a bounce event is posted to that listener from SendGrid, you could then lookup the user that needs to be notified via the recipient email. If you don't have this relationship available in your local store, you could pass a unique argument to SendGrid at send time that contains information you can use for the lookup - unique arg information is included with event notifications. Then it's just a matter of taking the appropriate action required to notify your user - either with an email or via a notice on your website or a text message or whatever is best for your application.

This maintains asynchronous communication. You'll be alerted when something goes wrong without having to add blocking code, and you can send your users a nice branded message (using SendGrid, of course) rather than just forwarding a mailer-daemon response .

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