====== 邮箱服务器 ======
邮件服务器 参考文章:[[https://blog.51cto.com/u_15127557/4065429|Ubuntu搭建简易Postfix邮箱服务器]] [[https://www.gundam.com.tw/2021/12/07/%E5%A6%82%E4%BD%95%E5%9C%A8-ubuntu-20-04-%E4%B8%8A%E5%AE%89%E8%A3%9D%E5%92%8C%E9%85%8D%E7%BD%AE-postfix/|文章二]] {{fa>thumbs-o-up}}
常用命令(以serverback为例):
hostname -f // 查看当前主机名
sudo nmap 10.0.0.211 // 检测端口
host 152.70.53.150 // ptr 反向域名
dig -x 152.70.53.150 // 主机详细记录
sudo hostnamectl set-hostname
测试SMTP端口是否通畅,测试成功后输入 ''%%quit%%'' 退出连接。
sudo apt install telnet
telnet gmail-smtp-in.l.google.com 25 // 连接谷歌邮箱端口
Trying 66.102.1.27...\\
Connected to gmail-smtp-in.l.google.com.\\
Escape character is '^]'.\\
220 mx.google.com ESMTP k15-20020a7bc30f000000b003a4f1df58f7si7130598wmj.37 - gsmtp\\
quit\\
221 2.0.0 closing connection k15-20020a7bc30f000000b003a4f1df58f7si7130598wmj.37 - gsmtp\\
Connection closed by foreign host.
安装 ''%%sudo DEBIAN_PRIORITY=low apt install postfix%%''\\
重新设置 ''%%sudo dpkg-reconfigure postfix%%''
===== Gmail =====
++ APP PW of Gmail | nlymjpfhxseudivd ++
[[https://hackmd.io/@fourdollars/SkfnuPrhH|使用Gmail代发邮件]] [[https://support.google.com/domains/answer/9437157?hl=zh-Hans|通过 Gmail 中的别名发送电子邮件 (官方)]]
将gmail添加的别名设置为默认发送人,每次通过server中的mail发送时就会显示 admin@simperator.com
官方示例
let transporter = nodemailer.createTransport({
service: 'gmail',
auth: {
user: 'gmail.user@gmail.com',
pass: 'yourpass'
}
});
===== QQ 邮箱 =====
[[https://www.jianshu.com/p/b1e5c9f1a103|node实现邮件发送]] 同理可使用 Gmail 发送。
let transporter = nodeMailer.createTransport('SMTP',{
host: 'smtp.qq.com',
secure: true,
port: 465,
auth: {
user: XXXXXXX@gmail.com',//邮箱
pass: 'XXXXXXX',//登入密码
}
});
const message = {
from: 'goldentianya@foxmail.com', // Sender address
to: $sendto, // List of recipients
subject: '华鹤易学 - 用户密码', // Subject line
text: `${name} 您好!
敬祝愉快安康!`
};
===== Mailu 系统 =====
[[https://www.youtube.com/watch?v=yksiOpBU2LQ|解说视频]] {{fa>youtube}} [[https://einverne.github.io/post/2021/07/email-server-mailu.html|Mailu 搭建邮箱]] {{fa>file-text-o}} [[https://www.ywbj.cc/?p=929|mailu邮件服务器]]
[[https://setup.mailu.io/1.9/|Mailu]] [[https://mailu.io/master/reverse.html|with extern proxy (nginx)]]
[[https://mailu.io/master/maintain.html|with extern cert]]
( ''%%apt install docker docker-compose%%'' )
为树莓派 build 一个镜像,参考这两篇文章:
* [[https://git.hownice.me/gprst/blog/src/branch/main/content/blog/email-server-on-raspberry-pi-with-mailu.md|Blog Github]]
* [[https://mailu.io/1.9/rpi_build.html|树莓派Build]]
wget docker-compose.yml
wget mailu.env
docker-compose -p mailu up -d
docker-compose -p mailu down
docker-compose -p mailu exec admin flask mailu admin admin 域名 密码
docker ps // 找到 mailu 的 id
docker port // 看到所有的端口映射
我的配置文件
cd /mailu
wget https://setup.mailu.io/1.9/file/1f21ff04-8f4a-458e-a571-a7c3a1c0c7a0/docker-compose.yml
wget https://setup.mailu.io/1.9/file/1f21ff04-8f4a-458e-a571-a7c3a1c0c7a0/mailu.env
初始化
docker-compose -p mailu up -d // 编译安装
// 设置管理员密码
docker-compose -p mailu exec admin flask mailu admin admin simpinvest.gq PASSWORD
// 生成一个用户名为hello@zsxwz.com的用户邮箱,密码为123456
docker-compose -p mailu exec admin flask mailu user hello zsxwz.com 123456
// 重设密码
docker-compose exec admin flask mailu password admin simperator.eu.org 123456
检查端口
netstat -tulpn | grep -E -w '25|80|110|143|443|465|587|993|995'
===== Amazon SES =====
[[https://zhuanlan.zhihu.com/p/358780018|Amazon SES 解决服务器被退信问题]] / [[https://aws.amazon.com|]]
[[https://docs.aws.amazon.com/zh_cn/ses/latest/dg/Welcome.html|SES 文档]] {{fa>amazon}}
===== Microsoft 365 E5 =====
[[https://admin.microsoft.com/adminportal/home/logout|Microsoft 365 admin]]
[[https://developer.microsoft.com/zh-cn/microsoft-365/profile|仪表盘]]
[[https://admin.microsoft.com/|]] [[https://docs.microsoft.com/en-us/microsoft-365/security/office-365-security/use-dkim-to-validate-outbound-email?view=o365-worldwide|Use DKIM to validate outbound email sent from your custom domain]]
===== Poste 项目 =====
[[https://qing.su/article/139.html|部署Poste邮件服务器]] [[https://poste.io/open|]]
===== Docker mailserver =====
[[https://github.com/docker-mailserver/docker-mailserver|Docker mailserver]] {{fa>github}}
===== ewomail 系统 =====
{{fa>youtube}} [[https://www.youtube.com/watch?v=C-qtbQ79avk|ewomail企业邮局搭建教程]]
===== Yandex 托管 =====
[[https://mail.yandex.com/|Yandex]]
====== CF + SMTP 中继 ======
这是一个新的解决思路:
- 通过 cloudflare 将邮件转送到 Gmail 或者任何的个人邮箱。CF 有 catch-all 功能,可以接收全域的邮件,甚至可以定制 no-reply 退信机制。
- 发件则通过 [[https://account.sendinblue.com/|sendinblue]] 或者 Amazon SES,或者其它的邮件服务商。
DNS 设置的时候,CF 和 sendinblue 同时都需要设定 SPF 记录,需要填写一条多域名的 SPF 记录。(([[https://www.renfei.org/blog/introduction-to-spf.html|SPF 记录:原理、语法及配置方法简介]])) (([[https://powerdmarc.com/zh/multiple-spf-records-on-email-domain/|多个SPF记录]])) (([[https://powerdmarc.com/zh/spf-record-syntax/|SPF记录的语法]]))
因为使用的都是大厂的服务,稳定性比自建邮局要高出很多。可以考虑 simperator.com 依然托管在 zoho mail. 网站发信则通过SMTP中继服务。
* Amazon SES: 每月1000封信 (之后每1000封信收0.10$)
* sendinblue: 每日300封信
* emails.pabbly: 每日500封信