How do I send signed emails from ActionMailer in Rails 3?
Using Rails 3 I want to use an X.509 certificate to sign parts of emails. There is a currently existing answer for Rails 2 at How do I send signed em开发者_开发百科ails from ActionMailer? but it doesn't work on Rails 3.
Is it possible to sign emails via ActionMailer in Rails 3? If that is not possible, is it possible to sign emails via sendmail after creating by ActionMailer?
perhaps it's not the best answer, however here's what I'd do:
try to install that plugin (even if it's for rails 2.0.x)
tests and fix code until I get the result
looking at the code, turns out that the core file is:
https://github.com/penso/actionmailer_x509/blob/master/lib/actionmailer_x509.rb
which exposes a bunch of methods for mailer DSL:
- x509_sign true # or false
- x509_cert "path/to/cert"
- x509_key "path/to/key"
- x509_passphrase "passphrase"
so you could grab that file, and put it under $APP/lib, then write some test to check it's working.
A.
I have been ported actionmailer_x509 to Rails 3 and wrap it into the gem. So now it works and available here: https://github.com/petRUShka/actionmailer_x509
精彩评论