Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have linux (debian) box which is running fine. However I have problem I need to find out what program is sending emails when i use "mail" command. Or for that matter when a PHP script is sending emails with mail() function I need to know what program is sending those emails.

How can I find out?

Ps: To clear, I'd like to know what program is invoked when I (or a program) use the "mail" command.

There are 2-3 MTA's installed on my server but I can't find out which one is responsible for sending mail.

share|improve this question

What you're asking how to do:
dpkg -S /path/to/mail

/path/to/mail/ can be found using which mail, provided that mail is in your path.

Minor Note:
Mail also be sent out using sendmail instead of mail.

What you should do:
Look at your maillog, likely /var/log/maillog or /var/log/mail.log the daemon name should be there.

share|improve this answer
which mail gives me /usr/bin/mail and when I do dpkg -S /usr/bin/mailIt says not found. However /var/log/mail.logshows the daemon as postfix so I am assuming postfix is responsible for sending out emails. – Sinan Oct 3 '12 at 23:58

strace will expose the behaviour of your code - whether it is executing a program or making a TCP connection to a mailserver.

share|improve this answer

Your Answer


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.