実現したいこと
有識者の方がいらっしゃいましたら教えてください。。。
現在環境内でクローズドなメール受送信の環境をPostfix(とdovecot)にて構築中です。
やりたいこととしては、外部宛先へのメールを外部には送信せず、ローカルのメールユーザ(hogetest-mail)に転送するというものです。
発生している問題・分からないこと
main.confおよびtransportファイルを以下のように更新し、postmap コマンドでデータベースを更新し、Postfixをリロード(または再起動)したあとで、PHPにてメール送信を行いました。
外部宛先=hoge.user@hogehoge.jpがtransport設定で書き換わる想定でしたが
maillog
1Jan 17 19:17:44 ip-XX-XX-XX-XX postfix/local[3401]: 0D38928002F86: to=<hoge.user@hogehoge.jp>, relay=local, delay=0.03, delays=0.02/0/0/0.01, dsn=5.1.1, status=bounced (unknown user: "hoge.user")
上記のように、宛先が同じままローカルに送信され、hoge.userはいないためバウンスされてしまっています。。
なぜ メールが ローカルのhogetest-mail へ転送されず、ローカルで配送しようとしてバウンスするのかわかるかたはいらっしゃいませんか・・・??
該当のソースコード
Postfix
1compatibility_level = 2 2queue_directory = /var/spool/postfix 3command_directory = /usr/sbin 4daemon_directory = /usr/libexec/postfix 5data_directory = /var/lib/postfix 6mail_owner = postfix 7myhostname = hogetest-mail.localhost 8mydomain = localhost 9myorigin = $mydomain 10inet_interfaces = all 11inet_protocols = all 12mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain 13local_recipient_maps = 14unknown_local_recipient_reject_code = 550 15mynetworks = 127.0.0.0/8 16alias_maps = hash:/etc/aliases 17alias_database = hash:/etc/aliases 18home_mailbox = Maildir/ 19 20smtpd_banner = $myhostname ESMTP unknown 21debug_peer_level = 2 22debugger_command = 23 PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin 24 ddd $daemon_directory/$process_name $process_id & sleep 5 25sendmail_path = /usr/sbin/sendmail.postfix 26newaliases_path = /usr/bin/newaliases.postfix 27mailq_path = /usr/bin/mailq.postfix 28setgid_group = postdrop 29smtpd_tls_cert_file = /etc/pki/tls/certs/postfix.pem 30smtpd_tls_key_file = /etc/pki/tls/private/postfix.key 31smtpd_tls_security_level = may 32smtp_tls_CApath = /etc/pki/tls/certs 33smtp_tls_CAfile = /etc/pki/tls/certs/ca-bundle.crt 34smtp_tls_security_level = may 35meta_directory = /etc/postfix 36shlib_directory = /usr/lib64/postfix 37message_size_limit = 10485760 38mailbox_size_limit = 1073741824 39transport_maps = hash:/etc/postfix/transport 40sample_directory = /usr/share/doc/postfix/samples 41readme_directory = /usr/share/doc/postfix/README_FILES 42manpage_directory = /usr/share/man 43html_directory = no 44
Postfix
1localhost local: 2localhost.localdomain local: 3* local:hogetest-mail 4
mail送信
1<?php 2$to = 'hoge.user@hogehoge.jp'; 3$subject = 'Test Mail from PHP mail'; 4$message = 'This is a test mail sent by PHP script using Postfix.'; 5$headers = 'From: hoge@hoge.jp'; 6 7if(mail($to, $subject, $message, $headers)) { 8 echo "Mail sent successfully.\n"; 9} else { 10 echo "Mail sending failed.\n"; 11} 12?>
maillog
1Jan 17 19:17:44 ip-XX-XX-XX-XX postfix/pickup[3394]: 0D38928002F86: uid=0 from=<root> 2Jan 17 19:17:44 ip-XX-XX-XX-XX postfix/cleanup[3399]: 0D38928002F86: message-id=<20240117101744.0D38928002F86@hogetest-mail.localhost> 3Jan 17 19:17:44 ip-XX-XX-XX-XX postfix/qmgr[3395]: 0D38928002F86: from=<root@localhost>, size=422, nrcpt=1 (queue active) 4Jan 17 19:17:44 ip-XX-XX-XX-XX postfix/local[3401]: 0D38928002F86: to=<hoge.user@hogehoge.jp>, relay=local, delay=0.03, delays=0.02/0/0/0.01, dsn=5.1.1, status=bounced (unknown user: "hoge.user") 5Jan 17 19:17:44 ip-XX-XX-XX-XX postfix/cleanup[3399]: 12A6428003347: message-id=<20240117101744.12A6428003347@hogetest-mail.localhost> 6Jan 17 19:17:44 ip-XX-XX-XX-XX postfix/bounce[3402]: 0D38928002F86: sender non-delivery notification: 12A6428003347 7Jan 17 19:17:44 ip-XX-XX-XX-XX postfix/qmgr[3395]: 12A6428003347: from=<>, size=2395, nrcpt=1 (queue active) 8Jan 17 19:17:44 ip-XX-XX-XX-XX postfix/qmgr[3395]: 0D38928002F86: removed
試したこと・調べたこと
- teratailやGoogle等で検索した
- ソースコードを自分なりに変更した
- 知人に聞いた
- その他
上記の詳細・結果
上に記載している通りとなります。。
補足
特になし

回答1件
あなたの回答
tips
プレビュー