OS X: Mail.app Logging

Most people owning a Mac use the Mail.app application to send and receive their e-mail, the program works as announced and should provide enough functionality for most of us. But, when it comes to diagnostics, there isn’t a lot to be found. The “Activity Window”—as a logging-aid—leaves a lot of guesswork why something didn’t work out the way we intended it to work. Or to word it a little less politely: We have no idea whatsoever why we couldn’t connect to a mail-server, we just know it didn’t work. Isn’t there anything we could do?

Obviously there is, writing this post wouldn’t make sense otherwise, would it? :mrgreen: One way would be to capture the packages flowing from and to the machine using tcpdump. On the other hand, Macs tend to be noisy regarding network-traffic. Wading through the result-file isn’t everybody’s idea of fun. (Mine neither, by the way.) There has to be another way. And there is:

/Applications/Mail.app/Contents/MacOS/Mail -LogActivityOnPort 25

If we’re starting Mail.app from the command-line like this, we are able to persuade it to tell us what happens while using the mentioned port. The output is written to the terminal-window where we issued the command and should give us a good idea of what is going on. The command shown above logs activity on the SMTP-port, if we want to monitor our POP-activity, we’d have to use port 110; you get the idea.

Happy logging. 😉

Technorati Tags: ,


  1. Dean
    Posted August 9, 2007 at 6:04 pm | Permalink

    One should not forget to set the buffer in Terminal.app, you might miss entries.

  2. Erik
    Posted August 10, 2007 at 6:04 am | Permalink

    Right, but I think the default setting of 10.000 lines should be sufficient. :mrgreen:
    Thanks for the hint. 😉

2 Trackbacks

  1. […] a bit of googling, I finally came across a post on Erik’s Lab that explained how to sniff any Mail.app communications, regardless of encryption.  Apparently […]

  2. By Silently broken Gmail | joe crobak's website on April 2, 2011 at 10:40 pm

    […] One day, though, gmail IMAP silently stopped syncing. I could login, but no mail was being transfered. I tried everything — synchronizing accounts, rebuilding the mailbox, but nothing worked. I was hoping to enable some more verbose logging, when I came across an old article from eriklabs.com about Mail.app Logging. […]

Post a Comment

Your email is never published nor shared. Required fields are marked *, comments are moderated.