Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

What is a good MTA (e.g. Postfix or something else) setup for a home computer behind a NAT, or a laptop that is not always online?

I've read a lot of Postfix tutorials on how to set it up this way or that, but they are usually geared towards computers that are servers ie they

  • have a static IP
  • have a domain name
  • are always connected to the same network

My requirements are, I guess:

  • Ability to redirect mail for local users to another server of my choosing.
  • No listening for incoming SMTP connections - outgoing only
  • Ability to route outgoing mail via an external SMTP server with authentication (and perhaps encryption)

If not Postfix, I need an MTA which can queue up mails in case it temporarily has no internet connection.

share|improve this question
    
I looked into nullmailer, which looks pretty ideal, except that a) in the default setup, the smtp password is world-readable (visible to all local users) and b) I'm not sure about how it handles the smtp server being occasionally unavailable or refusing/bouncing mail. –  thomasrutter Sep 22 '10 at 4:51
    
Since writing this question I've become a lot more familiar with Postfix and realise it's actually quite versatile - I can do this pretty easily. I've also thought twice about letting local PCs relay mail for anyone on the internet through my external SMTP server. Now, if they want to send mail to arbitrary addresses, they have to log onto the external mail server. My local relay will only be relaying mail to my own domains. –  thomasrutter Jan 23 '13 at 0:28
add comment

4 Answers

up vote 3 down vote accepted

I used to use Postfix on my PC, and it worked really fine. The only downside to it is that Postfix always runs a few daemons (master, qmgr, etc), and with exim I could reduce that to a sendmail -q crontab entry.


For Postfix:

  • set relayhost
  • for SMTP TLS, smtp_tls_security_level=encrypt
  • for SMTP relay auth, smtp_sasl_auth_enable and smtp_sasl_password_maps
  • comment out smtp service in master.cf

For Exim:

  • add a gateway router (example)
  • comment out the dnslookup router
  • for SMTP TLS, add a new transport using smtp but with TLS enabled (docs)
  • stop the exim daemon (to disable listening for SMTP)
  • and add sendmail -q to root's cron (to flush queue every X minutes; normally the daemon would do this)
share|improve this answer
    
My vote would be to use Exim. It can be configured to run without daemons, and at most has one daemon which wakes up every queue run period. It is easily configured to use a smarthost which will meet your requirements. –  BillThor Feb 28 '11 at 22:45
add comment

If you have a gmail account, you should install postfix and configure it to use your gmail account as a relay.

E.g. http://www.marksanborn.net/linux/send-mail-postfix-through-gmails-smtp-on-a-ubuntu-lts-server/

The main issue with setting up postfix on a roaming machine (sounds like you're on a laptop) is that e-mail sent from domains without MX or PTR records is very likely to end up in the spam folder or not even get delivered at all.

By relaying your email through your gmail account, though, you make it much more likely to get your e-mail delivered.

BTW, what was your ultimate goal? Sounds like you are receiving mail on a local unix account (maybe from cron?) and want to get it forwarded to somewhere you'll actually read it. Correct?

share|improve this answer
    
I have an external mail server that I would like to forward to, and was thinking of using Postfix (or something like it) on the laptop just to relay any outgoing mail to that server. But I'm not sure how to go about setting Postfix up that way and even if Postfix is the best choice. I want to ensure that if outgoing mails are generated locally while not online, they are queued and relayed later. I'd probably also want to get Postfix, or whatever, to authenticate with my external mail server somehow, so it will be trusted (without me having to relax the setup on the remote mail server). –  thomasrutter Feb 28 '11 at 7:07
    
Setting up postfix is pretty easy on most linuxes. Just 'apt-get install postfix' (or whatever your pkg manager is) and then edit the the /etc/postfix/main.cf and set the line "relayhost = [host]:port". (The square brackets are required if you use an FQDN.) Postfix will also queue e-mails when it can't reach the relay host, but you may need to tweak its definition of "failure" depending on how frequently you will be unable to reach the relay host. postfix.org/QSHAPE_README.html#deferred_queue –  mehaase Mar 4 '11 at 4:36
add comment

Most big MTAs like Postfix, Sendmail, Exim or qmail are overkill for your requirements.

Try using a minimal MTA like ssmtp, nbsmtp, or nullmailer instead. Their configuration is really easy and they're able to do everything you mentioned.

share|improve this answer
    
Are any of these able to queue mail while I'm not connected to the net (say the connection goes down or it's a laptop used in various locations) and send it when it's connected again? Cos I'd really need for mail NOT to go into a black hole if there's simply no net connection. –  thomasrutter Oct 3 '10 at 15:34
    
I'd suggest esmtp, even if it's no longer maintained, because it works w/o problems. It has also queue support, but I haven't used it. –  przemoc Feb 25 '11 at 10:38
add comment

Did you have a look at Lamson? I's easier to set up than postfix and friends...

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.