ActionMailer and Exchange

Posted by Jason Nerer on Stack Overflow See other posts from Stack Overflow or by Jason Nerer
Published on 2009-11-18T09:47:56Z Indexed on 2010/03/20 16:01 UTC
Read the original article Hit count: 886

Hello Community,

I successfully send Mails via SMTP using my Rails App and my Postfix Server. Now I need to move to an Exchange: Microsoft ESMTP MAIL Service, Version: 6.0.3790.3959 that has POP3 and SMTP support enabled.

I use actionmailer 1.2.5 and am not able to successfully login to the server while trying to send a mail.

In case I use Mail.app sending and recieving works fine as long as I change the authentication schema to "Password". Checking the server looks like so:

READ Nov 18 10:37:00.509 [kCFStreamSocketSecurityLevelNone]  -- host:mail.my-mail-server-domain.com -- port:25 -- socket:0x11895cf20 -- thread:0x11b036a10
250-mail.my-mail-server-domain.com Hello [xxx.xxx.xxx.xxx]
250-TURN
250-SIZE
250-ETRN
250-PIPELINING
250-DSN
250-ENHANCEDSTATUSCODES
250-8bitmime
250-BINARYMIME
250-CHUNKING
250-VRFY
250-X-EXPS GSSAPI NTLM LOGIN
250-X-EXPS=LOGIN
250-AUTH GSSAPI NTLM LOGIN
250-AUTH=LOGIN
250-X-LINK2STATE
250-XEXCH50
250 OK

WROTE Nov 18 10:37:00.852 [kCFStreamSocketSecurityLevelNone]  -- host:mail.my-mail-server-domain.com -- port:25 -- socket:0x11895cf20 -- thread:0x11b036a10
AUTH LOGIN

READ Nov 18 10:37:01.848 [kCFStreamSocketSecurityLevelNone]  -- host:mail.my-mail-server-domain.com -- port:25 -- socket:0x11895cf20 -- thread:0x11b036a10
235 2.7.0 Authentication successful.

So authentication method :login seems to be properly supported. Now when it comes to my configuration for actionmailer it looks like so:

ActionMailer::Base.server_settings = {
    :address => "mail.my-mail-server-domain.com",
    :port => 25,
    :domain => "my-mail-server-domain.com",
    :authentication => :login,
    :user_name => "myusername",
    :password => "mypassword"
}

And I get authentication errors over and over. I also tried to change

    :user_name => "my-mail-server-domain.com\myusername"
    :user_name => "my-mail-server-domain.com\\myusername"
    :user_name => "myusername/my-mail-server-domain.com"
    :user_name => "[email protected]"

but nothing works. Can anyone help me?

Regards. Jason

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about actionmailer