https://qiita.com/TanukiTam/items/abff82573c0f544b3b27
https://blog.tumf.dev/posts/diary/2025/1/10/mac-hostnames/
https://techblog.not-found.net/mail/macos-%e3%81%a7%e7%a8%bc%e5%83%8d%e3%81%95%e3%81%9b%e3%81%a6%e3%81%84%e3%82%8b-postfix-%e3%83%ad%e3%82%b0%e3%81%ae%e8%a6%8b%e6%96%b9/
mac OS: Monterey 12.7.6
--1. ユーザ追加
ユーザ名: testuser
--2. ホスト名設定
sudo scutil --set HostName hoge.example.com
scutil --get HostName
--3. postfix設定
sudo vi /etc/postfix/relay_passwd
smtp.example.com:587 testuser@fuga.example.com:xxxx
sudo postmap /etc/postfix/relay_passwd
ls -al /etc/postfix/
sudo rm -rf /etc/postfix/relay_passwd
下記追加
myhostname = hoge.example.com
mydomain = fuga.example.com
myorigin = $mydomain
relayhost = smtp.example.com:587
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/relay_passwd
smtp_sasl_security_options = noanonymous
smtp_sasl_mechanism_filter = plain
disable_dns_lookups = yes
--4. postfix再起動
sudo postfix stop
sudo postfix start
sudo postfix reload
sudo postfix status
--5. 動作確認
log stream --predicate '(process == "smtpd") || (process == "smtp")' --info
echo "test" | mail -s "test" testuser@fuga.example.com