views:

819

answers:

2

I'm going nuts here, trying to get my system configured.

I have a laptop at home and a workstation at work. I use mutt and sendmail. I have a home isp that is on a lot of blacklists, so that any email I send from my laptop through my isp is frequently blocked as spam by the receiver. I can ssh to my workstation and use mutt there interactively, but it is slow and tedious. I download my email from the work server to the laptop with fetchmail.

I've tried to get the laptop to send mail through the work mailer using ssh -L 25:workstation.work.com:25 workstation.work.com but it seems that sendmail cannot be running when I do this. When I try to fetchmail from workstation to the laptop sendmail must be running on the laptop for the mail to be delivered locally at the laptop. When mail does go through it gets rejected because the hostname is not recognised. I've tried changing the hostname in mutt. This appears not to affect anything.

So I'm confused about how to configure mutt, sendmail and ssh on my laptop, so that I can compose and send emails from my laptop such that they get delivered, yet I also want to get my emails from the server with fetchmail and have it delivered locally.

Any help appreciated.

+5  A: 

If you run that ssh tunnel, you can't be running sendmail locally because otherwise it will be listening on port 25, not your tunnel. And fetchmail by default wants a local mail server to deliver to, although you could configure it to deliver to an mbox file directly if you prefer.

What I do instead is I run postfix on my laptop, and have it set up to deliver mail to localhost:2526 using relayhost=[127.0.0.1]:2526 in /etc/postfix/main.cf. Then I run the ssh tunnel ssh -N -L 2526:localhost:25 ptomblin@myserver so that when postfix goes to deliver, it tunnels out through the tunnel. And local mail clients like mutt and fetchmail see a local mail server running on port 25 like they expect.

Paul Tomblin
A: 

Paul: your answer did the business! I was confused and should have been specifying -L 54321:localhost:25 instead of -L 54321:remotehost:25. Note the typo in your relayhost stanza. The square bracket should be closed before the colon, thus: relayhost=[127.0.0.1]:54321. Thanks for the tip on postfix. I have always used sendmail previously, somewhat blindly, and now on your suggestion have installed and used postfix and find the configuration an absolute delight in comparison to sendmail!

Chris Duncombe Rae
Isn't postfix's main.cf a joy after the horror of sendmail.cf? I've been using postfix for years.
Paul Tomblin
Makes me seriously wonder why I hung out with sendmail for so long!
Chris Duncombe Rae