如何在Ubuntu 20.04上将Postfix安装和配置为仅发送SMTP服务器

本教程介绍了如何在Ubuntu 20.04上安装和配置Postfix作为仅发送SMTP服务器。首先,通过安装mailutils包来安装Postfix,然后配置Postfix仅监听回送接口,以限制邮件发送到本地服务器。接着,通过修改main.cf文件,设置Postfix只发送邮件。然后,通过mail命令测试SMTP服务器,确保能够发送邮件。此外,还设置了邮件转发,将系统邮件转发到外部邮箱。最后,使用Let's Encrypt获取免费TLS证书,启用SMTP加密,防止邮件被标记为垃圾邮件。
摘要由CSDN通过智能技术生成

介绍 (Introduction)

Postfix is a mail transfer agent (MTA), an application used to send and receive email. It can be configured so that it can be used to send emails by local application only. This is useful in situations when you need to regularly send email notifications from your apps or have a lot of outbound traffic that a third-party email service provider won’t allow. It’s also a lighter alternative to running a full-blown SMTP server, while retaining the required functionality.

Postfix是一个邮件传输代理 (MTA),一种用于发送和接收电子邮件的应用程序。 可以对其进行配置,使其仅可用于通过本地应用程序发送电子邮件。 当您需要定期从应用程序发送电子邮件通知或第三方电子邮件服务提供商不允许的大量出站流量时,这很有用。 它是运行成熟的SMTP服务器的较轻的替代方案,同时保留了所需的功能。

In this tutorial, you’ll install and configure Postfix as a send-only SMTP server. You’ll also request free TLS certificates from Let’s Encrypt for your domain and encrypt the outbound emails using them.

在本教程中,您将安装Postfix并将其配置为仅发送SMTP服务器。 您还将向我们的域的Let's Encrypt请求免费的TLS证书,并使用它们对出站电子邮件进行加密。

先决条件 (Prerequisites)

Note: Your server’s hostname and your Droplet’s name must match your_domain, because DigitalOcean automatically sets PTR records for the Droplet’s IP address according to its name.

注意:服务器的主机名和Droplet的名称必须匹配your_domain ,因为DigitalOcean会根据其名称自动为Droplet的IP地址设置PTR记录。

You can verify the server’s hostname by typing hostname at the command prompt. The output should match the name you gave the Droplet when it was being created.

您可以通过在命令提示符下键入hostname来验证服务器的主机hostname 。 输出应与您在创建Droplet时提供的名称匹配。

第1步-安装Postfix (Step 1 — Installing Postfix)

In this step, you’ll install Postfix. The fastest way is to install the mailutils package, which bundles Postfix with a few supplementary programs that you’ll use to test sending email.

在此步骤中,您将安装Postfix。 最快的方法是安装mailutils软件包,该软件包将Postfix与一些补充程序捆绑在一起,您将使用这些补充程序来测试发送电子邮件。

First, update the package database:

首先,更新软件包数据库:

  • sudo apt update

    sudo apt更新

Then, install Postfix by running the following command:

然后,通过运行以下命令来安装Postfix:

  • sudo apt install mailutils

    sudo apt安装mailutils

Near the end of the installation process, you will be presented with the Postfix configuration window:

在安装过程快要结束时,将显示“ Postfix配置”窗口:

The default option is Internet Site. That’s the recommended option for your use case, so press TAB, and then ENTER. If you only see the description text, press TAB<

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值