Zach
Zach

Reputation: 895

Can't connect to exchange server to send mail via SMTP in ruby

I have tried everything I can think of. I have tried with all authentication types I can think of.
here are my settings

delivery_method :smtp, { 
                       :address              => "xxxxxxxxx.com",
                       :port                 => port,
                       :domain               => 'xxxxxx.com',
                       :user_name            => 'username',
                       :password             => "passworde",
                       :authentication       => 'plain',
                       :enable_starttls_auto => true  }

here is my error if I use port 25 (I believe this to be the correct port)

c:/Ruby193/lib/ruby/1.9.1/net/smtp.rb:960:in `check_auth_response': 504 5.7.4 Unrecognized authentication type (Net::SMTPAuthenticationError)

here is my error if I use port 587

c:/Ruby193/lib/ruby/1.9.1/openssl/ssl-internal.rb:121:in `post_connection_check': hostname does not match the server certificate (OpenSSL::SSL::SSLError)

Upvotes: 0

Views: 3184

Answers (1)

Paul Kehrer
Paul Kehrer

Reputation: 14089

The hash you're passing should have :plain defined as a symbol rather than a string per the ActionMailer::Base docs. The server is definitely responding on port 25 (that 504 5.7.4 Unrecognized authentication type error is from the server) so stick with that port.

It's also probably that plain auth is disabled on your server. Check out Cannot get ActionMailer working with MS Exchange via SMTP for more info.

Upvotes: 1

Related Questions