Forge To:使用 ActionMailer 的电子邮件标头
我想从我的 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
为什么不直接让
To
地址与From
地址相同呢?我认为这就是大多数邮件列表系统所做的。Why not just make the
To
address be the same as theFrom
address? I think that is what most mailing list systems do.您可以通过直接调用 /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 theenvelope to
address (also known as the RCPT TO address). This is basically how a bcc works.