Forge To:使用 ActionMailer 的电子邮件标头

发布于 2024-09-18 15:32:40 字数 689 浏览 7 评论 0原文

我想从我的 Rails3 应用程序向一组用户发送一封电子邮件,但有一个虚拟的“收件人”地址。

例如:

To: Some Entity
From: Some Entity
Bcc: [email protected], [email protected], [email protected]

但是,由于 ActionMailer 将其留给 MTA 来解析要发送到的电子邮件地址(而不是传递显式收件人列表),因此 MTA 会在无效的“收件人:”地址上出错。

是否有办法为 ActionMailer 的“收件人:”字段提供无效地址,或者分离电子邮件标头和 RCPT 列表?

I'd like to send an email from my rails3 application to a set of users but have a dummy To address.

For example:

To: Some Entity
From: Some Entity
Bcc: [email protected], [email protected], [email protected]

However, since ActionMailer leaves it up to the MTA to parse out the email addresses to send to (as opposed to passing an explicit recipient list), the MTA errors on the invalid To: address.

Is there anyway to provide a non-valid address for the To: field with ActionMailer or to divorce the email headers and RCPT list?

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

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

发布评论

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

评论(2

榆西 2024-09-25 15:32:40

为什么不直接让 To 地址与 From 地址相同呢?我认为这就是大多数邮件列表系统所做的。

Why not just make the To address be the same as the From address? I think that is what most mailing list systems do.

枉心 2024-09-25 15:32:40

您可以通过直接调用 /usr/sbin/sendmail 来完成此操作。邮件将发送到您在命令行中指定的任何收件人地址(这是envelope to 地址),但您可以在邮件标头中放置您想要的任何“To:”地址。收件人将看到您在标头中指定的“收件人:”地址,但邮件只会发送到“信封收件人”地址(也称为 RCPT TO 地址)。这基本上就是密件抄送的工作原理。

You can do this by calling /usr/sbin/sendmail directly. The message will be sent to whatever recipient address you specify in the command line (this is the envelope to address), but you can put any To: address you want in the message headers. The recipient will see the To: address that you specified in the headers, but the message will only be sent to the envelope to address (also known as the RCPT TO address). This is basically how a bcc works.

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