Nij*_*shy 4 smtp ruby-on-rails actionmailer
在活动邮件程序 smtp 设置中使用:plainvs作为身份验证有什么区别?:login
清楚的
ActionMailer::Base.smtp_settings = {
:address => 'smtp.sendgrid.net',
:port => '587',
:authentication => :plain,
:user_name => ENV['SENDGRID_USERNAME'],
:password => ENV['SENDGRID_PASSWORD'],
:domain => 'heroku.com',
:enable_starttls_auto => true
}
Run Code Online (Sandbox Code Playgroud)
登录
ActionMailer::Base.smtp_settings = {
:address => 'smtp.sendgrid.net',
:port => '587',
:authentication => :login,
:user_name => ENV['SENDGRID_USERNAME'],
:password => ENV['SENDGRID_PASSWORD'],
:domain => 'heroku.com',
:enable_starttls_auto => true
}
Run Code Online (Sandbox Code Playgroud)
在关于配置 smpt 设置(特别是发送网格)的不同教程中,我已经看到它们被使用。
他们似乎都在工作,那么这两者有什么区别呢?推荐哪一种?为什么?
我打算:plain使用base64编码来混淆凭据,那么这是最安全的吗?
长话短说,当您使用TLS时,您的凭据是安全的,因为它们是在加密连接上交换的。
根据此处的ActionMailer 文档,无论身份验证:plain或:login密码始终都是Base64编码的。编码的问题Base64在于任何窃听 SMTP 通信的人都可以轻松对其进行解码。所以这两种认证机制在安全性方面实际上是相同的。
但是,当您使用时,TLS连接会被加密,并且 Base64 凭据会通过此加密连接发送,从而确保其安全。如果您没有使用 TLS,那么最好使用 TLS:cram_md5来代替:login或:plain保护凭证。
| 归档时间: |
|
| 查看次数: |
6198 次 |
| 最近记录: |