If your server is configured to send emails with postfix, you should be familiar with some basic Postfix commands without any help from your sysadmin.
1. List your default and custom settings
If you have added your custom Postfix settings or set your own email aliases with virtual_alias_maps, you will find it with postconf -n.
1 2 3 4 5 6 |
$ postconf -n alias_database = hash:/etc/aliases alias_maps = hash:/etc/aliases broken_sasl_auth_clients = yes .... virtual_alias_maps = hash:/etc/postfix/virtual |
If you want to see your Postfix default settings, just change the parameter -n to -d.
1 2 3 4 5 6 |
$ postconf -d connection_cache_status_update_time = 600s connection_cache_ttl_limit = 2s ... virtual_mailbox_domains = $virtual_mailbox_maps virtual_mailbox_limit = 51200000 |
It’s a good practise to keep this output as a running configuration snapshot in a simple text file in case you have any troubles with Postfix after server reboot or software updates.
1 2 |
$ postconf -d > ~/YYYYMMDD.postfix.default $ postconf -n > ~/YYYYMMDD.postfix.custom |
2. List the current queue and email id’s
Check your postqueue frequently to make sure all your emails were delivered correctly. If everything is okay you will see the message “Mail queue is empty”. Otherwise, you will see a list of undelivered emails.
1 2 3 4 5 6 7 8 9 |
$ postqueue -p -Queue ID- --Size-- ----Arrival Time---- -Sender/Recipient------- 1B1CDC3312 2102 Tue Feb 17 00:00:01 root@web.yourserver.org (conversation with smtp.yourserver.org[72.2.43.23] timed out while receiving the initial server greeting) noreply@otherserver.com 94DD1C031A 1217 Fri Feb 20 00:00:02 root@web.yourserver.org (conversation with smtp.yourserver.org[72.2.43.23] timed out while receiving the initial server greeting) noreply@otherserver.com |
3. Read emails from the queue
1 |
$ postcat -q 94DD1C031A |
4. Delete emails from the queue
1 |
$ postsuper -d 94DD1C031A |