Sendmail smtp log

The classic sendmail SMTP log!

The sendmail SMTP log is a text file that records the communication between a sendmail server and other mail servers or clients. The log file typically contains information about the mail transactions, including:

  1. Connection establishment: The log file records the establishment of a connection between the sendmail server and the remote mail server or client.
  2. Mail transactions: The log file records the sending and receiving of email messages, including the sender, recipient, and message contents.
  3. Error messages: The log file records any errors that occur during the mail transaction, such as delivery failures or authentication issues.
  4. SMTP commands and responses: The log file records the SMTP commands and responses exchanged between the sendmail server and the remote mail server or client.

The format of the sendmail SMTP log file is typically as follows:

<timestamp> <level> <message>

Where:

Here's an example of a sendmail SMTP log entry:

2023-02-20 14:30:00 I <localhost[127.0.0.1]>: 220 localhost ESMTP Sendmail 8.15.2/8.15.2; Wed, 20 Feb 2023 14:30:00 +0000

This log entry indicates that a connection was established between the sendmail server (localhost) and a remote mail server (127.0.0.1) at 14:30:00 on February 20, 2023. The log level is I (info), and the message indicates that the sendmail server is responding to an EHLO command with its ESMTP capabilities.

To configure sendmail to log SMTP transactions, you can modify the sendmail.cf configuration file. For example, you can add the following lines to enable logging:

O LogLevel=20
O LogFile=/var/log/sendmail.log

This will enable logging at the DEBUG level and write the log entries to the /var/log/sendmail.log file.

Keep in mind that the sendmail SMTP log file can grow quite large over time, so it's a good idea to rotate the log file regularly to prevent it from consuming too much disk space.