Updated: 01-August-2005
Check out the author's weblog: David's World |
Without direct access to the mail (SMTP) server installed at their internet service provider or their company/workplace, many people are deprived from their usual means of communication: email. While they can check emails from everywhere, sending is prohibited, because of technical security measures. In tech-speak: modern SMTP servers force their users to use a specific domain part. That means, if your email address is david@nicecompany.com, chances are that you won't be able to send messages from outside NiceCompany while you're on the road. You can't use NiceCompany's e-mail service, and you can't use any other e-mail service either.
Why's that? Security measures! NiceCompany and everyone else have to keep spammers away, who would use their mail servers as a stepping stone to everybody's mailboxes. On the other hand, if you use a free mail service, such as Yahoo, Hotmail or GMX, they will probably force you to use their e-mail address. Even internet service providers that target professional and semi-professional markets may not let you send e-mails with a foreign address in their "From" field. T-Online in Germany nowadays charges you a few bucks extra a month if you want to use their relay server. Or, you're in an organization that blocks port 25, a data channel used to transport e-mails from your machine, then from one server to another.
I have two solutions for the dilemma. The very simple one is explained here. You will need an authenticating mail server that relays mail for you, operating on port 587 (submission) instead of port 25. If you have such a server available (from your ISP or web-host), this is much easier and more reliable than solution two.
This is the second solution: Simply run your own SMTP server locally on your laptop. Newer versions of Apple's Mac OS X operating system, starting with 10.3 (Panther), come with the SMTP server postfix pre-installed, set up and almost ready to go. I will show how to activate and configure it, and how you can install postfix on the older "Jaguar" system.
Oh, by the way. SMTP stands for Simple Mail Transfer Protocol. But that's not important to keep in mind. In fact, once you've set up postfix, you can almost forget about it. It does its job in the background!
There are one or two drawbacks to this approach, and these become more and more imminent. Using your own mail server from dialup connections can result in your e-mail being rejected. More here.
Still, I cannot guarantee the below settings to work in all cases, and to resist subsequent changes by other programs. There, you and only you are responsible for keeping your machine safe. You have been warned.
sudo chown -R postfix /private/var/spool/postfix sudo chown root /private/var/spool/postfix sudo chown root /private/var/spool/postfix sudo chown :postdrop /private/var/spool/postfix/public sudo chown :postdrop /private/var/spool/postfix/maildrop sudo chown :postdrop /usr/sbin/postqueue sudo chown :postdrop /usr/sbin/postdrop sudo postfix start
Instead, you can simply instruct postfix to use their SMTP server if necessary, that is, if a firewall blocks direct e-mail connections. Simply add the following line to main.cf:
fallback_relay = mailsmtpserver.mydomain.com
Obviously, you need to insert the address of your company-provided SMTP server here.
Some e-mail clients such as Apple Mail let you pick a server everytime you send an e-mail. The solution via postfix is much more comfortable: configure once, enjoy everytime.
You're much better off with an alternative, that is easier to configure: Postfix. In the following, I will give a step-by-step introduction how to install in. It's dead-easy!
sudo touch /etc/aliases # create empty aliases file if necessary newaliases
cd cd DesktopThen, extract the file using
tar -xvfz postfix*(drop the 'z' if it's not a .gz file.). Use
cd postfix*to change to this directory.
makeThis will take a while, but should not end with an error message.
cd auxiliary/MacOSX
sudo ./backup-sendmail-binaries sudo ./niscript (cd ../..; sudo make install)The make install script will ask you a lot of questions. Just hit Enter all the time -- this way, everything will be installed in its normal locations. In case the make install script asks you for setgid , tell it maildrop
pico /etc/postfix/main.cfAdd two lines to this file. myhostname = ... tells postfix what the name of your machine is. mynetworks_style = ... is a security measure. Here's what it should look like:
myhostname = mymachine.mydomain.com mynetworks_style = host(Replace mymachine.mydomain.com with a name and an existing top-level domain for your machine. The machine does not have to have a static and/or public IP address. Just pick a name, and pick a domain that ideally belongs to you. Make sure you replace the last statements in the file -- sometimes the Apple system installers seem to add stuff at the end, which overwrites earlier statements.)
mkdir /Library/StartupItems
sudo ./backup-postfix-binaries sudo ./activate-postfixThis works well with postfix version postfix-2.0.10 and postfix-2.0.13.
bash-2.05a$ telnet localhost 25 Trying ::1... telnet: connect to address ::1: Connection refused Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. 220 madonna.mle.ie ESMTP PostfixThe output should be like shown above.
inet_interfaces = localhostto
inet_interfaces = all
sudo postfix stop
sudo postfix start
sudo postfix reload
sudo postfix check- if this brings warnings or error messages about faulty file ownership or wrong permissions, chances are that you've run the OS X "repair permissions" program (for example from Disk Utility), which has messed up the postfix files. That's easy enough to repair. Download this Script (Control-click the link on to save it to your home folder) and run it with
chmod +x repair-postfix-permissions ./repair-postfix-permissionsThis should help you! The script may ask for your user password.
Unfortunately, there is no instant remedy for this -- except sending the e-mail again, this time via some permanently installed SMTP server provided by your ISP, your organization or your service provider.
You can try to use the fallback_relay option as described earlier, in order to use the company SMTP server when possible. Because switching back and forth is cumbersome, I recommend that you find an SMTP server that offers SMTP-AUTH to the world. That way, only trusted customers can use the server.
Of course, there is a local SMTP server to be used. But that doesn't work from outside, which means, I'd have to switch servers in my mail client all the time. No good!
Ideally, one would always use an SSL-based SMTP server, which not only works in such cases, but is also more secure. In my case, I resorted to an alternative that I discovered only through a bit of investigation.
My provider (1&1) offers an authenticated SMTP not just on port 25, but also on a port 587, known as 'submission' (technical details here!). One just needs to point the local mail program to that port.
In case your e-mail is marked as spam for other reasons, it may make sense to try to use a certificate stating that your e-mail is legimitate. HABEAS is a company offering such certificates, which are recognized by widespread SPAM filters such as SpamAssassin. Their license is free for personal, non-commercial use, and for internet service providers. Wired has a story.
Disclaimer: Please send me your suggestions and comments. However, I won't be able to help you troubleshooting unless you'd like to hire me as your consultant.
Thanks to Joel Rennich, who wrote an article that shows that installing postfix is not so hard after all. Also thanks to toby Z, Stephen Evans, Mark McLaughlin and .k who all dropped me a line to make this explanation even better...