Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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!

share|improve this question

2 Answers 2

up vote 0 down vote accepted

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"

where the /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:

generated-mails: /var/local/spool/generated-mails

(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.

share|improve this answer
    
Thank you for your reply! The problem was that I needed to retrieve a log from mails sent in the past (before a measure like the one you described above was taken). I'll be adding this feature in the future though. –  Flock Dawson Oct 16 '13 at 8:17

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\["
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.