Getting action mailer to work on OSX with sendmail

Hi all, I’m trying to get action mailer to work with my dev environment on my OS x laptop. I have the following configuration for action mailer in my development.rb

ActionMailer::Base.raise_delivery_errors = true

#send mail with sendmail ActionMailer::Base.delivery_method = :sendmail

Everything appears to go ok, but when I view my mail.log file from my mail viewer, I see the following.

Oct 9 20:09:08 todd postfix/smtp[4648]: 0AC052D9B96: to=< todd.nine@gmail.com>, relay=none, delay=92235, status=deferred (Host or domain name not found. Name service error for name=gmail.com type=MX: Host not found, try again)

Oct 9 20:09:08 todd postfix/smtp[4650]: 8C284486133: to=todd.nine@gmail.com, relay=none, delay=76, status=deferred (Host or domain name not found. Name service error for name= gmail.com type=MX: Host not found, try again) Oct 9 20:09:08 todd postfix/smtp[4651]: CF9D72D9B52: to=todd.nine@gmail.com, relay=none, delay=92446, status=deferred (Host or domain name not found. Name service error for name= gmail.com type=MX: Host not found, try again) Oct 9 20:09:08 todd postfix/smtp[4649]: 5B6612D9C3D: to=todd.nine@gmail.com, relay=none, delay=90714, status=deferred (Host or domain name not found. Name service error for name= gmail.com type=MX: Host not found, try again)

I know this is an OSX issue, and not a ruby issue, but if anyone has set up Actionmailer on OSX (sendmail or otherwise), can you send me some info on how you were able to get it working? All of the tutorials I find on sendmail and osx are about 10 pages long and involve receiving email. I don’t want to set up an email server, I just want to be able to send test email!

Thanks, Todd

What does 'dig gmail.com mx' say? It's possible your ISP is somehow thinking that blocking MX queries will cause you not to send spam when someone gets a virus.

For me, it says:

; <<>> DiG 9.4.1-P1 <<>> gmail.com mx ;; global options: printcmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 3508 ;; flags: qr rd ra; QUERY: 1, ANSWER: 5, AUTHORITY: 4, ADDITIONAL: 0

;; QUESTION SECTION: ;gmail.com. IN MX

;; ANSWER SECTION: gmail.com. 3600 IN MX 10 alt1.gmail-smtp-in.l.google.com. gmail.com. 3600 IN MX 10 alt2.gmail-smtp-in.l.google.com. gmail.com. 3600 IN MX 50 gsmtp163.google.com. gmail.com. 3600 IN MX 50 gsmtp183.google.com. gmail.com. 3600 IN MX 5 gmail-smtp-in.l.google.com.

;; AUTHORITY SECTION: gmail.com. 345600 IN NS ns1.google.com. gmail.com. 345600 IN NS ns4.google.com. gmail.com. 345600 IN NS ns3.google.com. gmail.com. 345600 IN NS ns2.google.com.

;; Query time: 169 msec ;; SERVER: 10.42.255.254#53(10.42.255.254) ;; WHEN: Tue Oct 9 02:38:32 2007 ;; MSG SIZE rcvd: 230

You’re correct. Dig works fine for everything except MX records. It doesn’t work for gmail, hotmail, or yahoo. Since I can’t go the easy route and just use sendmail, I have to connect to an SMTP server. Gmail requires TLS, and I don’t want to set up yet another external dependency in testing. I managed to find my ISP’s smtp setting and set it up with the following actionmailer config.

ActionMailer::Base.smtp_settings = { :address => “send.xtra.co.nz”, :port => 587, :user_name => “barneygumble”, :password => “yeahright!”,

:authentication => :login }

Thanks for the help Michael!

Todd