Saturday, January 15, 2011

mail.app can't send mail using that server

Last October I migrated the lovely Carol's computing environment to a mac mini running snow leopard. Incoming mail was handled with an ssh tunnel to our ISP (localhost 60110 forwards to our ISP port 110), but I figured outbound mail didn't need anything that fancy, as our IP address should be on our ISP's list of "good" email addresses.

But lately we've been getting unhappy returns... mail.app would pop up with a "Can't send mail..." and would not tell me why. When the symptom appeared, I tried "telnet mail.ourISP.net 25" and manually-entered mail worked just fine. Wha...??

So this morning, when the symptom hit again, I sat down to do battle. I didn't see wireshark under Applications→Utilities; I didn't see ethereal. So it was time to go Neanderthal; I brought up a Terminal window and said

$ type tcpdump
tcpdump is /usr/sbin/tcpdump        ← Oh yeah, we're in business!
$ sudo tcpdump -w /tmp/tcpdump-mail-try1 -p 
tcpdump: listening on en0, link-type EN10MB (Ethernet), capture size 65535 bytes
Now I didn't actually hit <ENTER> on that tcpdump command until I had a mail message ready to send in mail.app. I hit <ENTER> to start off tcpdump, clicked "Send" in mail.app, got the nasty "Can't send using that server" window from mail.app, and then hit control-C in the Terminal window, thus interrupting tcpdump.

Next step was to copy the tcpdump output file to my OpenSUSE box and look at it with wireshark. A minute later I understood how this attempt failed, even though my "telnet" method worked fine.

Frame number 1 in the main window had the necessary information: we were connecting to our ISP's mail server, not using port 25 as I had thought, but using port 587. I clicked on Analyze&rarrFollow TCP stream and saw that my ISP was asking for authentication, which I didn't really want to send. But what is port 587?

collin@p3:~> grep 587 /etc/services
submission 587/tcp    # Submission
submission 587/udp    # Submission
… remainder elided
Submission, huh? Well, I shouldn't have to submit in this context; I want to use port 25. But how to change it? Google to the rescue! It led me this page, which shows how to tell mail.app to use a different port. Basically, it's Preferences, Accounts, Account Information, Server settings (outbound), Advanced, and in our version of mail.app, set "custom port" -- which I set to 25.

No comments: