如何将本地工具的出站邮件服务添加到“最小化”debian系统?

我有几台服务器在debian上运行应用程序。 每个应用程序都有它需要的软件包,而不是更多。

目前没有邮件发送function。 但是,我想像cron这样的工具的输出被邮寄给我。

服务器托pipe在一个ISP站点上,该站点提供了一个我应该用于所有出站邮件的“智能中继”服务器。

我应该如何configuration我的debian服务器:

  • 允许像cron这样的本地工具发送邮件,就像[email protected](我特别不想'root @ machinename')
  • 不提供任何入站邮件服务
  • 使用ISP提供的“智能中继”作为出站邮件

什么软件包适合这种“最小”的邮件服务?

类似于这个答案 ,但我更喜欢设置exim使用一个智能主机,并没有本地邮件时,该框实际上并没有充当邮件服务器。

  • apt-get install exim4
  • 运行dpkg-reconfigure exim4-config
    • 是的,拆分configuration
    • validation系统名称是否正确
    • 监听地址应该是'127.0.0.1'
    • 其他目的地应该是系统fqdn
    • 中继的域名应保留空白
    • 机器继电器应该留空
    • smarthost应该是你的smtp服务器的主机名
  • 更新/ etc / aliases并在电子邮件地址处指向我想要的服务消息。

你想要ssmtp ,一个超级简单,真正微不足道的configuration出站邮件中继。 它也非常小,非常适合embedded式系统。

这种configuration称为“nullclient”configuration。 一些指南可用:

  • 后缀: http : //www.postfix.org/STANDARD_CONFIGURATION_README.html#null_client
  • Sendmail: http : //www.sendmail.org/m4/features.html

对于sendmail,你应该需要它:

FEATURE(`nullclient', `mailhub.domain.notused')dnl 

一些发行版(openSuSE)为此提供了一个单独的“nullclient.mc”configuration文件。

发送专用邮件程序有几种select。 ssmtp已经被提及,但是msmtp和nbsmtp也将完成这项工作。

我喜欢使用exim,在Debian上快速设置非常简单。 当出现exim4-config提示时,select“internet site”作为主要configuration,运行以下命令。 所有其他选项是相当自我解释,确保域名设置正确,以匹配前进,并优先反向dns。

 sudo aptitude install exim4 sudo dpkg-reconfigure exim4-config 

然后,编辑/ etc / aliases看起来像:

 root: [email protected] 

最后运行newaliases做邮件的根本工作(对于cron等)

 sudo newaliases 

现在你应该可以做类似的事情了

 $mail root Subject: Hello What a fine day! . Cc: 

更新:我testing了蚀刻,而不是lenny,在已经configuration的安装,我已经纠正了上面的错误。 不知道什么lenny做什么。 这也适用于Ubuntu 8.04。 此外,我更新了这一点,以反映你需要正确设置域

在Debian上,Postfix软件包安装后会询问你的基本configuration。 “卫星”选项可能是你所追求的。

请select最符合您需要的邮件服务器configurationtypes。  │ 
             ││ 
             │没有configuration:│ 
             │应该select保持当前configuration不变。  │ 
             │互联网网站:│ 
             │邮件使用SMTP直接发送和接收。  │ 
             │智能互联网:│ 
             │邮件直接使用SMTP或运行一个实用程序│收到 
             │作为fetchmail。 发送邮件使用智能主机发送。  │ 
             │卫星系统:│ 
             │所有邮件都发送到另一台称为“智能主机”的计算机上进行传送。  │ 
             │只有本地:│ 
             │唯一发送的邮件是本地用户的邮件。 没有networking。  │ 
             ││ 
             │邮件configuration的一般types:│ 
             ││ 
             │没有configuration│ 
             │互联网网站│ 
             │智能互联网│ 
             │卫星系统│ 
             │只限本地            

我认为你会发现最简约的包是nullmailer 。 自己不太了解,但似乎正是你要找的。 debian软件包简单地称为nullmailer 。 从包描述:

 Description: simple relay-only mail transport agent Nullmailer is a replacement MTA for hosts, which relay to a fixed set of smart relays. It is designed to be simple to configure and especially useful on slave machines and in chroots. The sendmail interface of this package doesn't provide the -bs switch, hence it's not LSB compatible! Homepage: http://untroubled.org/nullmailer/ 

正如我所说,我不太了解,对我来说,它只是一个开箱即用的工具,还有一些非常小的configuration(如邮件地址..)。

我认为你可以在某种提交模式下运行sendmail,这意味着所有的邮件都被转发到智能中继(我认为)。 自己没有这样做,因为我一直在使用postfix的年龄。

你可以运行一个本地的postfix实例,并让它将所有的电子邮件转发到你想读取邮件的其他服务器。