Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
add comment

2 Answers 2

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
add comment

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
add comment

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.