Postfix
==============================
Edit Outgoing IP in Postfix:
==============================
# /etc/postfix/master.cf
# change "smtp_bind_address="
==============================
Show Queue
==============================
NB: this command shows the sender and recipients and ID, not the message itself. The ID is particularly useful if you want to inspect the message itself.
==============================
View message (contents, header and body) in Postfix queue
==============================
postcat -vq XXXXXXXXXX #Replace XX with the message ID from 'mailq'
==============================
Tell Postfix to process the queue now
==============================
postqueue -f
postfix flush
postsuper -r ALL
==============================
Delete queued mail
==============================
postsuper -d ALL
postsuper -d ALL deferred # Delete only the differed mail queue messages
==============================
[Postfix] Clear mail queue for specific mailbox:
==============================
mailq | tail +2 | awk 'BEGIN { RS = "" } / user@example\.com$/ { print $1 }' | tr -d '*!' | postsuper -d -
==============================
A useful feature for web servers is to enable mail.add_x_header = on in the Postfix configuration. This will add a header to all outgoing email messages showing the script and user that generated each message. Once enabled this will then add the following extra header to message:
X-PHP-Originating-Script: 1001:spamEmailer.php
In this example 1001 is the UID and the spamEmailer.php was the script sending the message. This can allow you to quickly track down the source of spam messages being sent by your server.