Smokes your problems, coughs fresh air.

Tag: mail

Working with a postfix mail queue

Some useful commands when working with a postfix mailqueue:

  • “postsuper -r ALL”. Requeues all messages.
  • “postcat [file]”. Views queue files in /var/spool/bla.
  • “postqueue”. Deal with queue.
This one is to remove all messages with a certain recipient:
mailq | tail -n +2 | grep -v '^ *(' | awk  'BEGIN { RS = "" }  { if ($8 == "" && $9 == "") print $1 } ' | tr -d '*!' | postsuper -d -

I believe there were more, but I can’t remember them. Wish I had blogged earlier…

Default e-mail addresses for domains

Sometimes automated services or people need to contact some domain administrator for a certain domain. There are a couple of addresses that should be present by default. Google uses these addresses to notify you when they put you on their malware blocklist:

  1. abuse@
  2. admin@
  3. administrator@
  4. contact@
  5. info@
  6. postmaster@
  7. support@
  8. webmaster@

I think I need these for my domains to be present by default:

  1. abuse@
  2. postmaster@
  3. hostmaster@
  4. webmaster@
  5. root@

Configuring a Debian satellite Exim server

A very common way to configure Exim on a Debian machine, is to make it a ‘satellite’; a server which uses another SMTP server for sending and does not do local delivery, the latter being the difference with a ‘smarthost’. It can be used by other computers in the network to send mail, but also by the machine itself, to send system notifications and such (one of my favorite apps, arpwatch, for example).

The following needs to be in /etc/update-exim4.conf:

dc_smarthost='[your SMTP server]'

The following needs to be in /etc/mailname:


[mailname] is the same in both locations, and is simply the FQDN (world wide, not just local, such as which should appear after the @-sign. The reason that it must entered in both places, is because both have a different function. ‘etc/mailname’ Takes care of putting the specified domain after the @-sign if you mail to, for example, root. The ‘dc_other_hostnames’ is to let the server know that this is the machine that handles that domain. If you don’t specify the ‘dc_other_hostnames’, the server will just try to send it to the next relay. BTW, ‘dc_other_hostnames’ is colon (;) seperated.

Make sure the FQDN you use exists, otherwise a lot of mailservers refuse to accept it. What I don’t understand, though, is that in my experience, whatever you use as domain doesn’t have to exist as MX record, but just as an A record.

Also don’t forget to include an alias for root in /etc/aliases. I usually let all mail sent to root be sent to a local user, and alias that local user to an outside e-mail address.

© 2024 BigSmoke

Theme by Anders NorenUp ↑