简体   繁体   English

sendmail的ssh隧道

[英]ssh tunnel for sendmail

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. 我用mutt和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. 我有一个家庭ISP,在很多黑名单上,所以我从笔记本电脑通过我的ISP发送的任何电子邮件经常被接收者阻止为垃圾邮件。 I can SSH to my workstation and use mutt there interactively, but it is slow and tedious. 我可以通过SSH连接到我的工作站并以交互方式使用mutt,但这很慢且很乏味。 I download my email from the work server to the laptop with fetchmail. 我用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. 但是当我这样做时,似乎sendmail无法运行。 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. 当我尝试从工作站fetchmail到笔记本电脑时,必须在笔记本电脑上运行sendmail才能在笔记本电脑上本地传送邮件。 When mail does go through it gets rejected because the hostname is not recognised. 当邮件通过时,它会被拒绝,因为主机名无法识别。 I've tried changing the hostname in mutt. 我试过改变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. 所以我对如何在我的笔记本电脑上配置mutt,sendmail和SSH感到困惑,这样我就可以从我的笔记本电脑编写和发送电子邮件,以便他们得到发送,但我也希望通过fetchmail从服务器上获取我的电子邮件它在当地交付。

Any help appreciated. 任何帮助赞赏。

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. 如果您运行该ssh隧道,则无法在本地运行sendmail,否则它将侦听端口25,而不是您的隧道。 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. 默认情况下,fetchmail需要本地邮件服务器才能传送,但是如果您愿意,可以将其配置为直接传送到mbox文件。

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. 我做的是我在我的笔记本电脑上运行postfix,并设置为使用relayhost=[127.0.0.1]:2526 /etc/postfix/main.cf将邮件传递给localhost:2526。 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. 然后我运行ssh隧道ssh -N -L 2526:localhost:25 ptomblin@myserver这样当postfix进行传递时,它会通过隧道隧道传输。 And local mail clients like mutt and fetchmail see a local mail server running on port 25 like they expect. 而像mut​​t和fetchmail这样的本地邮件客户端就像他们期望的那样看到在端口25上运行的本地邮件服务器。

Paul: your answer did the business! 保罗:你的回答是做生意的! I was confused and should have been specifying -L 54321:localhost:25 instead of -L 54321:remotehost:25. 我很困惑,应该指定-L 54321:localhost:25而不是-L 54321:remotehost:25。 Note the typo in your relayhost stanza. 注意你的relayhost节中的拼写错误。 The square bracket should be closed before the colon, thus: relayhost=[127.0.0.1]:54321. 方括号应在冒号前关闭,因此:relayhost = [127.0.0.1]:54321。 Thanks for the tip on postfix. 感谢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! 我以前总是使用sendmail,有点盲目,现在你的建议已经安装并使用了postfix,并且发现配置与sendmail相比绝对令人高兴!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM