Quantcast
Channel: NETWORK ENGINEER BLOG
Viewing all articles
Browse latest Browse all 266

Postfix から Gmail へリレーする設定

$
0
0

Gmailの設定

Gmail の設定で安全性の低いアプリを許可します。

Postfixと SASL インストール

# yum install -y postfix
# yum -y install cyrus-sasl-plain cyrus-sasl-md5

Postfixの設定

# vi /etc/postfix/main.cf
myhostname = host.example.com
mydomain = example.com
myorigin = $mydomain
inet_protocols = ipv4
mynetworks = 127.0.0.0/8
relayhost = [smtp.gmail.com]:587
smtp_sasl_auth_enable  = yes
smtp_sasl_password_maps = hash:/etc/postfix/smtp-auth-passwd
smtp_sasl_security_options = noanonymous
smtp_sasl_tls_security_options = noanonymous
smtp_sasl_mechanism_filter = plain
#tls setting
smtp_use_tls = yes
smtp_tls_security_level = may
smtp_tls_loglevel = 1

パスワードファイル作成

# vi /etc/postfix/smtp-auth-passwd
[smtp.gmail.com]:587 xxxxxx@gmail.com:PASSWORD

パスワードファイルからデータベースを作成

# postmap /etc/postfix/smtp-auth-passwd

Postfix再起動

# /etc/init.d/postfix restart

動作確認

Mailx インストール

# yum -y install mailx

Mail コマンド

# echo "test" | mail -s "test" xxxxx@gmail.com

Gmailへメールが送信できます。

以上


Viewing all articles
Browse latest Browse all 266

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>