开发者

Forge To: email header with ActionMailer

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: foo@example.com, bar@example.com, baz@example.com

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 ActionMai开发者_StackOverflowler or to divorce the email headers and RCPT list?


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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜