Postfixからcygwin等でGmail経由でメールを送信するための設定メモ
- ソフトを入れる
apt-cyg install mailutils
apt-cyg install postfix
PostfixからGmail経由でメールを送信するための設定メモ | あぱーブログ アプリパスワードがめんどくさい。
Windows 10 or 11 (WSL2)のUbuntuでsystemctlを利用する方法(systemdをPID1で動作させる方法) | Snow System
gmail の設定 (1)google account →セキュリティー →2段階認証をon (2)google account →セキュリティー→ アプリパスワードでmail を選ぶ
postfix の設定 (1)/etc/postfix/gmail に、アプリパスワードがabcdefghijklmnop の場合
<< (2) chmod 600 /etc/postfix/gmail その後、データベースを作る sudo postmap /etc/postfix/gmail
(3) Postfixの設定ファイルの最終行に以下の設定を追加。 vi /etc/postfix/main.cf
relayhost = smtp.gmail.com:587 smtp_sasl_auth_enable = yes smtp_sasl_password_maps = hash:/etc/postfix/gmail smtp_sasl_security_options = noanonymous smtp_sasl_tls_security_options = noanonymous smtp_sasl_mechanism_filter = plain smtp_use_tls = yes <<
ログファイルは cat /var/log/maillog