I would like postfix to not accept incoming mail. I do however use it for sending e-mail, so I cannot simply uninstall it.

How can I configure postfix to reject all incoming mail?

  • 2
    any clues in this link? digitalocean.com/community/tutorials/… – User24601 May 5 '19 at 5:42
  • I used mailbox_size_limit = 0 recipient_delimiter = + inet_interfaces = localhost but I still get mensages I want don't get more mensages for keep server clean – Amadeu Antunes May 5 '19 at 12:44
  • So you don't want your server to have any email at all? Why not run apt remove postfix then? – Fabby May 5 '19 at 19:07
  • I would like to still send e-mail but don't storage the e-mails received like no-reply – Amadeu Antunes May 6 '19 at 9:10
  • 3
    @fkraiem So because spam is a problem, you are not voting to reopen an on topic question on askubuntu? Properly assisting a user in configuring the mail server could reduce spam as well. – vidarlo May 7 '19 at 7:16

This is described as a null client in Postfix' documentation.

Configure postfix to only listen to loop back by changing inet_listen to

inet_listen = loopback-only

in /etc/postfix/main.cf

This effectively blocks incoming connections, disallowing mail delivery. In addition, you should set

my_destinations = 

This disables all local mail delivery. This should obviously only be used if you want mail for e.g. root and similar (typically crontab-generated) to be sent to an external host. If you want local delivery of such mail, leave my_destinations as is.

Postfix' documentation has some more information about your attempted configuration, including full explanations of options.

| improve this answer | |
  • I will try this solution when I get chance to check it and I will give you the feedback. – Amadeu Antunes May 7 '19 at 8:58
  • Thank you so much for your help – Amadeu Antunes May 7 '19 at 8:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.