Centos7 使用postfix实现Gmail邮件转发
本文最后更新于 443 天前,其中的信息可能已经有所发展或是发生改变。

1. Gmail开启SMTP功能

方式自行百度,此处不展示

2. 安装postfix

yum install postfix cyrus-sasl-sql cyrus-sasl-plain cyrus-sasl-lib mailx

3. 配置main.cf文件

vim /etc/postfix/main.cf //编辑main.cf文件
底部添加以下内容

relayhost = [smtp.gmail.com]:587
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_sasl_tls_security_options = noanonymous
smtp_tls_security_level = may

4. 新建邮箱认证配置文件

vim /etc/postfix/sasl_passwd
并添加以下内容
[smtp.gmail.com]:587 [email protected]:wixhljacufesesws

前半段为smtp服务器地址及端口,后半部分为你的邮箱地址及密码(SMTP授权码)

修复权限并更新 postfix 配置以使用 sasl_passwd 文件:

chmod 400 /etc/postfix/sasl_passwd 
postmap /etc/postfix/sasl_passwd

重启postfix saslauthd
systemctl restart postfix
systemctl restart saslauthd

5. 邮件测试

echo "Test mail from postfix" | mail -s "Test Postfix" [email protected]

此时你可以收到一封
主题为 Test Postifx;内容为 Test mail from postfix 的邮件
暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇