I've got a Debian mail server, and I use the mail command to send confirmation e-mails when users register our website. Is there any way to view a list of the mails that were sent?
Any help much appreciated!
You're doing it wrong. Add a
Bcc ("blind carbon copy") header to all your generated mails containing a special technical address, say,
generated-mails, then add an entry for it to the system aliases table, like this:
generated-mails: "| /usr/local/bin/process-generated-message"
/usr/local/bin/process-generated-message should be an executable program which expects the message on its standard input and does with it whatever it wants.
Alternatively, you can just append these messages to a file:
(Note that this file must be writable by the user (and/or group) which
postfix on your system uses when it's delivering mails locally — this is OS-dependent.)
The details are explained here.
I recommend using
Bcc header field (and not
Cc) as it gets stripped off from the message when it's being sent do the actual recipients, so they don't see this cruft in their messages.
After some digging, I found out there are some records in the /var/logs/syslog files So I used grep to sort them out:
cat syslog | grep "localhost postfix/smtp\["