
私は、GMail サーバー経由で電子メールを送信するようにサーバー proxmox1 を設定しました。以下は、/etc/postfix/main.cf の関連部分です。
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = proxmox1
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
mydestination = $myhostname, localhost.$mydomain, localhost
# p1 has an IP in the range 192.168.1.0/24
mynetworks = 127.0.0.0/8 192.168.1.0/24
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = ipv4
relayhost = [smtp.gmail.com]:587
smtp_use_tls = yes
smtp_sasl_auth_enable = yes
smtp_tls_security_level = encrypt
smtp_sasl_password_maps = hash:/etc/postfix/sasl/sasl_passwd
smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt
smtp_sasl_security_options = noanonymous
mailx と proxmox1 上の postfix サーバーを使用して、サーバー p1 からメールを送信しようとしています。 .mailrc ファイルは次のとおりです。
set smtp=smtp://proxmox1
set from="[email protected](p1)"
私が使用するコマンドは次のとおりです。
echo "Test message" | mailx -s "important mail" [email protected]
proxmox1 上の postfix がポート 25 でさまざまな Google メール サーバーに接続しようとするため失敗します (proxmox1 上の /var/log/mail.log)。
Apr 22 11:45:00 p1 postfix/smtp[6888]: connect to aspmx.l.google.com[142.250.27.26]:25: Connection timed out
Apr 22 11:45:30 p1 postfix/smtp[6888]: connect to alt2.aspmx.l.google.com[142.250.150.27]:25: Connection timed out
Apr 22 11:45:30 p1 postfix/smtp[6888]: connect to alt1.aspmx.l.google.com[2a00:1450:4025:c03::1a]:25: Cannot assign requested address
Apr 22 11:45:30 p1 postfix/smtp[6888]: connect to alt2.aspmx.l.google.com[2a00:1450:4010:c1c::1b]:25: Cannot assign requested address
Apr 22 11:45:30 p1 postfix/smtp[6888]: D331827596: to=<[email protected]>, relay=none, delay=179091, delays=179031/0.01/60/0, dsn=4.4.1, status=deferred (connect to alt2.aspmx.l.google.com[2a00:1450:4010:c1c::1b]:25: Cannot assign requested address)
proxmox1 で同じコマンドを実行すると、異なるログが出力されます。
Apr 22 12:03:38 proxmox1 postfix/pickup[280663]: 87E1211695: uid=0 from=<root>
Apr 22 12:03:38 proxmox1 postfix/cleanup[340498]: 87E1211695: message-id=<20230422100338.87E1211695@A>
Apr 22 12:03:38 proxmox1 postfix/qmgr[280664]: 87E1211695: from=<root@A>, size=420, nrcpt=1 (queue active)
Apr 22 12:03:40 proxmox1 postfix/smtp[340500]: 87E1211695: to=<[email protected]>, relay=smtp.gmail.com[142.250.102.109]:587, delay=2.2, delays=0.1/0.11/0.75/1.2, dsn=2.0.0, status=sent (250 2.0.0 OK 1682157820 u13-20020a170906c40d00b0094aa087578csm3131703ejz.171 - gsmtp)
Apr 22 12:03:40 proxmox1 postfix/qmgr[280664]: 87E1211695: removed
relay_host
p1 からメールを送信するときにオプションが無視されるようです...
何か案が ?
マーク