How to change Postfix hostname and SMTP banner on Plesk server

Connect to a Plesk server via SSH.

Create a copy “postfix” configuration file:

# cp -a /etc/postfix/ /root/

Open “postfix” configuration file in a text editor, for example, “vi” editor:

# vi /etc/postfix/

Add the lines specified below to the configuration file and make sure that these lines are present only once in the file:

Note: replace with required mail server name.

myhostname =
smtpd_banner = $myhostname ESMTP $mail_name

Using command line tool. check “postfix” configuration syntax and restart postfix:

postfix check
(empty output - means syntax is OK)
# service postfix restart

How to redirect local root mail to an email address with Postfix

After you install postfix, then you may wnat to have root’s email sent to a real email address. This will help to send cron jobs to you.

Edit the /etc/aliases file and add your username and external email address.

# root:

Now run this command:-

# newaliases

Now restart Postfix:-

# service postfix restart

and to test, run the following command:-

# echo test | mail -s "test message" root

Remove specific domain or user emails in Postfix

To remove specific emails from a domain:

# postqueue -p | tail -n +2 | awk 'BEGIN { RS = "" } /@domain\.com/ { print $1 }' | tr -d '*!' | postsuper -d -


# mailq | tail -n +2 | grep -v '^ *(' | awk  'BEGIN { RS = "" } { if ($8 == "USER@EXAMPLE.COM" && $9 == "") print $1 } ' | tr -d '*!' | postsuper -d -

Change Plesk Postfix Retry Time

Is it possible to change the time for mail to give up on sending (Retry) from 5 days which is right now to like 1 day or 12 hours for plesk postfix MTA?

Edit the following to /etc/postfix/ near the top:

# nano /etc/postfix/
maximal_queue_lifetime = 1h
maximal_backoff_time = 15m
minimal_backoff_time = 5m
queue_run_delay = 5m


Fatal: bind port 25: Address already in use with plesk server

Post fix restart produces the following

# tail -f /usr/local/psa/var/log/maillog
Mar  4 21:40:07 postfix/postfix-script[24660]: fatal: the Postfix mail system is not running
Mar  4 21:40:08 postfix/postfix-script[24731]: starting the Postfix mail system
Mar  4 21:40:08 postfix/master[24732]: fatal: bind port 25: Address already in use

Look for multiple instances of smtp inet n – n – – smtpd and comment them out:

#smtp inet n - n - - smtpd
localhost:smtp inet n - n - - smtpd
smtp_bind_address6= -o smtp_address_preference=ipv4
#smtp inet n - n - - smtpd

Restart postfix

# service postfix restart

Notice: Error: EHLO not accepted from server

Error in plesk postfix email logs:

Notice: Error: EHLO not accepted from server! in /var/www/vhosts/ on line 237

Check postfix main and comment out non_smtpd_milters:

smtpd_milters = , inet:
#non_smtpd_milters = , inet:

Restart postfix:

# service postfix restart
Shutting down postfix:                                     [  OK  ]
Starting postfix:                                          [  OK  ]

Postfix: mails sent through sendmail binary are blocked because of wrong HELO

My server is using Centos 6.5
I updated from Plesk 11.5 to 12 last week and postfix to 2.8.17.
Since then, all mails sent using the sendmail binary (notifications, mail forwards…) are being rejected with a wrong HELO hostname: localhost.
It seems that sendmail is using locahost as a HELO tag which is not accepted.


Qick Fix:

remove whole non_smtpd_milters from postfix in case you do not use commtouch.
If you would like to use commtouch then you can remove only “inet:” from non_smtpd_milters.
restart postfix.




X-No-Relay: not in my network” and “X-No-Auth: unauthenticated sender” in message


My server is using the Postfix mail server. For some reason, all messages it sends contain unnecessary headers, like the following:

X-No-Relay: not in my network


X-No-Auth: unauthenticated sender

The number of headers is multiplied by the number of message recipients, e.g., the headers of a message sent to two recipients would look like this:

X-No-Relay: not in my network
X-No-Relay: not in my network

Postfix adds those headers from these files:

# ls /var/spool/postfix/plesk/*re

The issue will be fixed in a future update for which a new Knowledgebase article will be created. You may subscribe to new articles on Parallels Plesk Panel products if you wish to receive notifications about their creation.

If you do not want messages to contain the above headers, clean (empty) these files:


nano /var/spool/postfix/plesk/

/^/ PREPEND X-No-Relay: not in my network

Clear Mail queue on Postfix or Plesk

How to clear the mailqueue.

Check the mailq:

# /usr/local/psa/admin/bin/mailqueuemng -s

View 5 of the items for a certain domain:

# /usr/local/psa/admin/bin/mailqueuemng -s | grep -C 5
# /usr/local/psa/admin/bin/mailqueuemng -D"


# postsuper -d ALL

If you get a permission error on an older PLesk 9 instance

# /usr/sbin/postsuper -d ALL

To remove specific emails from a domain:

# postqueue -p | tail -n +2 | awk 'BEGIN { RS = "" } /@domain\.com/ { print $1 }' | tr -d '*!' | postsuper -d -


# mailq | tail -n +2 | grep -v '^ *(' | awk  'BEGIN { RS = "" } { if ($8 == "USER@EXAMPLE.COM" && $9 == "") print $1 } ' | tr -d '*!' | postsuper -d -