How do I send signed emails from ActionMailer in Rails 3?

主宰稳场 提交于 2019-12-10 01:14:27

问题


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 emails 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?


回答1:


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.




回答2:


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



来源:https://stackoverflow.com/questions/6428983/how-do-i-send-signed-emails-from-actionmailer-in-rails-3

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!