Postfix – subject, from and to log

This is a little trick for Postfix, it lets you log the subject, from and to of all the emails postfix sends (or which pass through it if you run it as a relay). It comes in handy when you need to debug an email issue and need to confirm your mailserver has sent the message.

First create the file /etc/postfix/header_checks and insert this into it:

/^subject:/      WARN
/^to:/           WARN
/^from:/         WARN
/^Subject:/      WARN
/^To:/           WARN
/^From:/         WARN
Read More

Postfix limit

Postfix a way to limit the frequency of brute force?
In file /usr/local/etc/postfix/main.cf place something like the following:
Code:
...
# RATE THROTTLING
smtpd_client_connection_rate_limit = 20
smtpd_error_sleep_time = 10s
smtpd_soft_error_limit = 3
smtpd_hard_error_limit = 5
...

Read More

Posfix making sense of delays in mail

The maillog is easy enough to follow, but when you understand what all the delay and delays numbers mean then this may help really understand what is going on!
A standard email entry in postfix looks like:
Jan 10 10:00:00 testmtr postfix/smtp[20123]: 34A1B160852B: to=, relay=mx1.example.lan[1.2.3.4]:25, delay=0.49, delays=0.2/0/0.04/0.25, dsn=2.0.0, status=sent
Read More

Setup Relay Host Port and SMTP Authentication Client in Postfix

This setup will help you to route all outgoing email through your ISP SMTP server using different port number and that SMTP server requires you to authenticate before relaying. For this scenario, the ISP SMTP server is Exim.
1. Edit this file /etc/postfix/main.cf and add relayhost to point to your ISP SMTP server with port number as below: –
relayhost = mail.example.com:2525
2. Add the next parameter to allow Postfix to authenticate before relaying outgoing email as below: –
smtp_sasl_auth_enable = yes Read More

Postfix Queue Management

If emails are getting delayed, its better to inspect postfix mail queues, coupled with postfix mail log.

Status/Shape of Mail Queue

Postfix maintains different queues for different purpose.active  and  deferred queues are of our interest.
Ideally, we should never have a mail in deferred queue.
qshape command will show shape of active mail queue by default. Ideally it should be as close as to empty since postfix sends email instantly!

qshape

Read More