0

I have a server which hosts a number of applications mostly built with Drupal. These applications are configured to send mails and Postfix is my MTA.

Is it possible to have the applications and/or Postfix configured to identify in its log [maillog] which application or domain a mail originates from?

So for example, if I have applications/domains: a.com b.com and c.com, is it possible to show these against each mail in /var/log/maillog? Thanks.

pi.
  • 249
  • 3
  • 9

1 Answers1

0

There are multiple ways of identifying the webapp that delivered mail to your MTA:

  • sendmail UID: if you use the local sendmail utility to deliver mail to postfix, there will be a uid=312 present in your logs. Use different system users for you webapps so different uid's will show up in your logs.

  • the postfix qmgr should log the FROM address in the form of from=<mail@example.com> - that can help you differentiate.

  • you can use PHPs mail() additional_headers option to simply add the domain to your mail headers and use postfix header_checks to log you custom header.

r_3
  • 886
  • 5
  • 9