How to Find Out What Program is Sending Emails in Linux

configurationdebianemaillinux

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.

Best Answer

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.

Related Topic