هذا الجزء لم يُترجم بعد. أنت ترى النص الإنجليزي.
ماذا يفعل
Postfix sends and receives e-mail with SMTP (port 25, submission 587). On servers it is often only a relay: local programs (cron, monitoring, apps) send mail through Postfix to a smart host (Microsoft 365, SendGrid, Amazon SES, Hostinger SMTP) with TLS and a login. Settings are in main.cf (postconf edits them safely) and services in master.cf.
For your own domain you also need SPF, DKIM and DMARC DNS records, or your mail lands in spam.
طريقة الكتابة
postconf [-n] [-e 'key = value'] [KEY]
postqueue -p | -f ; postsuper -d ID|ALLالأجزاء الرئيسية
Tools
postconf-n- Show only changed settings.
postconfKEY- Show one setting.
postconf-e'KEY=VALUE'- Change a setting.
postqueue-p(mailq)- Show the queue.
postqueue-f- Try to send all queued mail now.
postsuper-dID/-dALL- Delete mail from the queue.
postcat-qID- Show a queued mail.
postfixcheck/reload- Check config / reload.
postmapFILE- Build lookup tables (sasl_passwd, transport).
الخيارات 7
الأكثر استخدامًا
Important main.cf settings
لا يوجد شيء يطابق هذا الفلتر.
أمثلة 10
$ مستخدم عادي# بصلاحية root (أو مع sudo)
1Install and send only from this host
2Relay through a smart host with TLS and login
postconf -e 'relayhost = [smtp.example.com]:587' 'smtp_tls_security_level = encrypt' 'smtp_sasl_auth_enable = yes' 'smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd' 'smtp_sasl_security_options = noanonymous' echo '[smtp.example.com]:587 alerts@example.com:Example-Only-Pass' > /etc/postfix/sasl_passwd chmod 600 /etc/postfix/sasl_passwd && postmap /etc/postfix/sasl_passwd systemctl reload postfix3Send a test mail
echo "Test from $(hostname)" | mail -s "Postfix test" ops@example.com journalctl -u postfix -n 204Look at the queue
postqueue -p postcat -q 4F2A91C0D1 postqueue -f5Clean the queue
postsuper -d 4F2A91C0D1 postsuper -d ALL deferred6See your changed settings
postconf -n7Check the config
postfix check8Check SPF, DKIM and DMARC of a domain
9Test TLS of a mail server
10Find why a mail was not sent
grep "status=deferred\|status=bounced" /var/log/maillog | tail -5 journalctl -u postfix --since "1 hour ago" | grep -E "status=(deferred|bounced)"
لا يوجد شيء يطابق هذا الفلتر.
انتبه
- Never be an open relay: keep
mynetworkssmall andinet_interfaces = loopback-onlyon app servers. - Many clouds (Azure, AWS) block outbound port 25 — use 587 to a relay service.
sasl_passwdcontains a password: rights600, and do not commit it.
الملفات
/etc/postfix/main.cf- Main settings.
/etc/postfix/master.cf- Services and ports.
/var/spool/postfix/- Queue.
/var/log/maillog or journal- Logs.
نصائح للحفظ
- Send monitoring and cron mails through one relay host, so only one server needs SMTP credentials.
رموز الخروج
0 | Success. |
1 | Error. |