Offline Mail Queues w/ Mac OS X? 48
Zorton asks: "After switching to Mac OS X (10.2) for my primary work/play environment I started to customize the system as I would a Linux or BSD system. One of the first things I wanted to tackle was getting mail into the machine and enabling offline mail queuing (as this is a laptop that roams quite a bit). After installing Fink I was happy to see some of my favorite MTAs available. However I was disappointed to discover there seems to be no mechanism similar to /etc/network/if-up.d (or similar). I spent a bit of time poking and prodding the system but the best I could come up with where some library functions listed on Apple's Developer Connection website. Has anyone tried to configure offline mail queues under Mac OS X 10.2? If you have how did you handle telling the MTA to transfer the mail you have queued up?"
THAT'S IT! (Score:1)
I've been nagged to try and setup something like this. No, I've not given it much thought. Yes, I am interested in everyones ideas. Cool! Thanks for reminding me of this one. I hope it's fruitful.
Umm, it's already there... (Score:5, Insightful)
If you need to use a different app just point it to the right folder and let OSX do the rest...
Re:Umm, it's already there... (Score:4, Informative)
XML files and shell scripts powering the mac location manager... never thought I'd see the day
Will this handle changes to outgoing mail servers? (Score:2)
Re:Will this handle changes to outgoing mail serve (Score:4, Informative)
If so, that would be the ideal method. All my accounts use localhost:2525 as the smtp server, and I have an ssh command something like ssh user@sshhost -C -v -L 2525:smtphost:25 -L 1101:pophost:110 to tunnel everything. If your ssh host does SSH2 (protocol version two, not version two of the software) you can use the -f -N options to background it, which makes it easy to start and stop from a location-triggered shell script. (and naturally, you'll want to use localhost:1101 as your pop server now, so that too will be encrypted)
Doing unencrypted pop and smtp from a laptop is never a good idea. Even if you're careful, eventually you'll probably leave your mail client open while you use your machine within range of some random wireless network, and then you'll be sending your cleartext password over not just the internet but also the public airwaves...
In addition to the security, another benefit to using ssh tunnels for pop and smtp is that your mail client can only get packets out to the internet when the ssh tunnel is up. It doesn't know the name of the actual internet servers, and if you killall ssh, connections to localhost2525 and localhost:1101 are simply refused and you've made no noise at all on the network. And another benefit is that you can have a local port open from behind any firewall (ie, use -R 8080:localhost:80 in your ssh command and http://sshhost.yourisp.net:8080/ will have your local webserver on it). I often use this for testing websites from behind the firewall at work.
Ok, I could go on more, but the point here is that ssh is damn cool.
Re:Will this handle changes to outgoing mail serve (Score:1)
The ssh solution is much more elegant (and secure), but out-of-the-box, things work pretty well.
google cache of the man page.... (Score:1, Insightful)
like you normally do....
Comment removed (Score:5, Informative)
Re:google cache of the man page.... (Score:5, Informative)
http://www.macosxhints.com/article.php?story=20
Pretty basic, but a quick start...
http://www.sial.org/sendmail/macosx/8.12.2-jagu
More technical and in depth for those who know and care.
And of course you can also google for "sendmail os x 10.2" like I did and find other resources.
Comment removed (Score:5, Informative)
Re:google cache of the man page.... (Score:2, Informative)
Re:google cache of the man page.... (Score:2)
The default install of sendmail is as easy to admin as qmail. A lot of the simple features are enabled by default, like virtualhosts, access lists, etc..
In terms of speed, for a machine that's not churning millions of mail a day, it's "good enough". Don't need a club to kill mosquitos
Re:google cache of the man page.... (Score:1)
Sure, but Sendmail is a resource hog, and you could be using those resources to do other things. No point tiring yourself out swinging a flyswatter around if there aren't any mosquitos.
Re:google cache of the man page.... (Score:2)
Sendmail is for smart people. (Score:2)
His well tuned Postfix was much faster than his untuned unix running an untuned Sendmail.
We tuned Sendmail. It smoked Postfix (200k+/hour/machine) before using better hardware (faster disks, not more CPUs).
So if Sendmail is too hard for you, then perhaps Unix (therefore Linux) is too hard and you should go back to Windows.
Re:google cache of the man page.... (Score:1, Redundant)
Probably part of Cocoa or Carbon (Score:1)
Re:Probably part of Cocoa or Carbon (Score:1)
Mail.app out box (Score:4, Informative)
Don't forget to set up rules in Mail.app for cc to yourself or whatever. Finally there are lots of 'hidden' features to Mail... that are standard on other mail progs... like bcc, that you just have to turn on via one of the menus.
Re:Mail.app out box (Score:1)
Re:Mail.app out box (Score:2)
stumped me for a bit until a colleague pointed out where it had moved too
If you are using ppp, pppoe, or similar... (Score:4, Informative)
When the connection is made it calls the shell script at:
When the connection is broken it calls the shell script at:
If you don't use ppp or pppoe (or anything else that uses pppd) then maybe there are similar scripts in other places. Hope this helps.
Develop something like /etc/network/if-up.d (Score:2, Informative)
I think you could easily develop something with similar functionality you want to have if you use the SystemConfiguration Framework - provided that you have some C/C++/Objective-C knowledge.
More informations about the framework mentioned above can be found here [apple.com] (http://developer.apple.com/techpubs/macosx/Networ king/SysConfigOverview926/index.html
).
Read the "Dynamic Agents" chapter...
Re:What about finding it yourself? (Score:1)
Then don't run a Macintosh if you don't want to run virtualizations of some kind. First off, your running a Unix-like system, and second off your running a completely different architecture. Those two things combined make it impossible to do without either Virtual PC or Bochs. Maybe VMWare if they come out with a OS/X version, but those are your choices.
Hello? Cron? (Score:4, Informative)
crontab:
* * * * *
#!/bin/zsh
if ([ test -e
then
if (ping -c 1 www.apple.com)
then
# we are already up
else
# we went down
rm
fi
else
if (ping -c 1 www.apple.com)
then
date >
else
# we were already down
fi
fi
Apple Script (Score:1)
diffrent ideas (Score:5, Insightful)
I think the underlying problem i'm having is the lack of any ip-d up script or anything like that. It seems to be obvious now after reading some of the comments posted, that the short term solution would be to use Mail app or point something else towards Mail.app's mail dir. I still would like to find out how the location manager does it's thing (Under the apple menu -> location). The API for it seems to be very well documented and perhaps I will end up coding something similar to a interface up script. In the meantime all I will do is install postfix and have it default upon startup to offline mode. Then i'll run a cron job about every minute or to check for up interfaces that have come up (ifconfig -u, and check the routing tables). Not quite as elegant as i've done in the past on a debian system using qmail but should get the job done. I think with a system like that I could grab e-mail from my pop box using another cron job (fetchmail?), and have a offline mail queue ready to go.
What do you think? Has anyone taken a closer look into the location manager's inner workings? I find it difficult to believe apple didn't provide any provision for advanced configuration of the interfaces (changing the MAC address or perhaps the MTU based on diffrent locations and options).
Thanks
Re:diffrent ideas (Score:3, Informative)
http://www.culater.net/osd/samba/samba.html
There's some info from Apple: http://developer.apple.com/techpubs/macosx/Networ
And it's not what you want, but if you want to change locations from the command line, you need to look at the nice command
What I want to be able to do is to be able to run a script when my laptop wakes up. Still haven't found something nice for that. I can run a program in the background all the time that gets notified of power events, but I'm sure that Apple already has something running which will do this. (I want to use a command line tool to sniff for wireless access points, and depending on what is found, switch my location. I can do it all...if I run the script manually, I just want it to run automatically on wakeup.)
Re:diffrent ideas (Score:1)
Thanks
Re:diffrent ideas (Score:3, Informative)
SCNetworkCheckReachabilityByName
or
SCNetworkCheckReachabilityByAddress
will both "determines if the given network host/node name is reachable using the current network configuration."
They will NOT cause a modem user to automatically dial.
Re:diffrent ideas (Score:3, Informative)
in case you didn't see the previous post above, i thought i'd restate that there IS a mechanism just like ip-d-up. it's a script called /etc/ppp/ip-up (and there's a corresponding /etc/ppp/ip-down). They probably don't already exist, but you can create them. I've got it chmod 700. My ip-up reads as follows (note that "sendmail" & "mailq" actually refer to my postfix executables):
#!/bin/sh
#send queued messages (really uses postfix)
/usr/local/sbin/sendmail -q
Q=`/usr/local/sbin/mailq`
if [ "$Q" != "Mail queue is empty" ]; then
logger -t $0 sending queued messages
fi
#update dyndns entry
/etc/ppp/ip-up.ddclient $*
Re:diffrent ideas (Score:1)
Re:diffrent ideas (Score:2, Informative)
Some ressources from O'Reilly (Score:4, Informative)
http://www.oreilly.com/catalog/mosxgeek
and
Top Ten Mac OS X Tips for Unix Geeks
http://www.oreillynet.com/pub/a/mac/2002/1
Re:Some ressources from O'Reilly (Score:1)
http://www.oreillynet.com/pub/a/mac/200
Er, configure sendmail? (Score:5, Informative)
UUCP and PPP meant spool up mail, send it periodially.
UUCP ran periodically (cron), when PPP started up, a startup script would run a sendmail queue runner.
The only difference here is (1) determining when you are "on the net" via ethernet or wireless and (perhaps) (2) using TLS and SMTP AUTH to allow you to send ANY TIME you are on ANY net - you authenticate yourself to a machine on the net and use TLS to encrypt the transaction. Or setup an IPSec connection to your server. Or use UUCP over SSH (scary, but I've done it).
Configure sendmail in "queue only mode" and treat it like an occasionally connected machine. This is basic (for mail).
Where are /. apple people? (Score:1)
SystemConfiguration.framework is your friend (Score:1)