【发布时间】:2016-01-21 16:47:10
【问题描述】:
我必须加密我的电子邮件附件。我通过 Mandrill Client(mandrillapp.com) 发送电子邮件。 我用来加密附件的 Gem 是 mail gpg (https://github.com/jkraemer/mail-gpg) 控制台日志中没有错误。并且电子邮件正在发送给我,但电子邮件/附件未加密。 你知道我的应用有什么问题吗? 我的代码:
def self.mailing(atr1, atr2)
key = '-----BEGIN PGP PUBLIC KEY BLOCK----- Version: GnuPG v1.4.12 (GNU/Linux)
mQGiBEk39msRBADw1ExmrLD1OUMdfvA7cnVVYTC7CyqfNvHUVuuBDhV7azs ....
-----END PGP PUBLIC KEY BLOCK----- '
mandrill = Mandrill::API.new 'YYYYYYYYYYYYYYYYYYYYYYYYYYY'
time = Time.now.strftime("%Y%m%d")
message = {
from_email: 'test@test.pl',
subject: "WWWWWWWWWWWWWW",
to: [{
email: App.settings.webservices[atr1]['email'],
type: "to"
},
{
email: App.settings.webservices[atr1]['email_bcc'],
type: "bcc"
}
],
attachments: [{
content: Base64.encode64(build_csv(atr2)),
name: "my_name" ,
type: 'text/csv',
gpg: { encrypt: true }# , keys: { App.settings.webservices['ggggg']['email'] => key} }
}],
# gpg: { encrypt: true, keys: { App.settings.webservices['ggggg']['email_bcc']} }
}
result = mandrill.messages.send message
result.first.with_indifferent_access
end
感谢您的帮助
【问题讨论】:
-
您只想加密附件而不是整个邮件?
-
哪个宝石确切地? Mandrill 说要使用 Mailchimp 宝石。
-
我使用的 gem 叫做 'mandrill-api'。我也尝试加密整个电子邮件,但结果是一样的。 mail-gpg 加密无效
标签: ruby-on-rails ruby encryption sinatra mandrill