Ruby 在 Rails 使用 SMTP Microsoft Exchange 邮件帐户时出错

Ruby on Rails error using SMTP Microsoft Exchange mail account

我正在尝试连接到部署在本地服务器中的 Microsoft Exchange 帐户。访问此服务器需要 VPN 连接。

我的应用已部署到另一台服务器并可以访问此 VPN。

当我尝试发送电子邮件时出现此错误:

Net::SMTPAuthenticationError: 504 5.7.4 Unrecognized authentication type

这些是我的 stmp_settings:

    config.action_mailer.default_url_options = { :host => ENV['EMAIL_DEFAULT_URL'] }
    config.action_mailer.delivery_method = :smtp
    config.action_mailer.smtp_settings = {
      address: 'example.com',
      port: 25,
      domain: ENV['EMAIL_DOMAIN'],
      authentication: :login,
      user_name: ENV['EMAIL_USERNAME'],
      password: ENV['EMAIL_PASSWORD'],
      openssl_verify_mode: 'none'
    }

谢谢!

首先尝试通过 telnet 发送电子邮件。然后检查您收到的错误消息。基于该测试,您可以构建所需的配置。

正如评论中已经讨论的那样,"plaintext authentication" 可能是最好的选择,但您可以通过 telnet 找到它。