Support us and view this ad

可选:点击以支持我们的网站

免费文章

第一部分:安装 Postfix 1. 安装 Postfix # 更新软件包列表sudo apt update # 安装 Postfix 和必要工具sudo apt install postfix mailutils libsasl2-modules sasl2-bin -y 2. 安装过程中的配置向导 安装过程中会出现配置对话框,按以下选择: 第一个对话框(配置类型): 选择配置类型:-> 选择 "Internet Site" 第二个对话框(系统邮件名称): 邮件服务器的主机名:-> 输入你的域名(如:yourdomain.com)或直接按 Enter 使用系统主机名 3. 安装完成后检查 # 检查 Postfix 状态sudo systemctl status postfix # 检查版本postconf -d | grep mail_version 第二部分:基本配置 1. 编辑主配置文件 sudo nano /etc/postfix/main.cf 2. 添加/修改以下配置 # ========== 基本设置 ==========# 服务器主机名(替换为你的域名)myhostname = mail.yourdomain.commydomain = yourdomain.com # 接收哪些域名的邮件mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain # 监听所有网络接口inet_interfaces = all # 协议版本inet_protocols = all # ========== 网络设置 ==========# 允许哪些网络通过本服务器发送邮件mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 192.168.0.0/24# 如果允许任意IP:mynetworks = 0.0.0.0/0 # ========== 邮件大小限制 ==========message_size_limit = 10485760 # 10MBmailbox_size_limit = 0 # 0表示不限制recipient_delimiter = + # ========== 安全设置 ==========# 防止被用作垃圾邮件中继smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination # 允许中继(重要!)relayhost = smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination # ========== TLS/SSL 设置 ==========# 启用 TLSsmtpd_use_tls = yessmtp_use_tls = yes # TLS 证书位置(先用自签名)smtpd_tls_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pemsmtpd_tls_key_file = /etc/ssl/private/ssl-cert-snakeoil....

继续阅读完整内容

支持我们的网站,请点击查看下方广告

正在加载广告...

登陆