Postfix: Difference between revisions

From miki
Jump to navigation Jump to search
Line 29: Line 29:
postmap -q mip@prime.immie.org hash:/etc/aliases regexp:/etc/aliases-regexp
postmap -q mip@prime.immie.org hash:/etc/aliases regexp:/etc/aliases-regexp
postmap -q mip hash:/etc/aliases regexp:/etc/aliases-regexp
postmap -q mip hash:/etc/aliases regexp:/etc/aliases-regexp
</source>

=== Handling deferred mail / message queue ===
Reference:
* [http://www.tech-g.com/2012/07/15/inspecting-postfixs-email-queue/ Inspecting Postfix’s email queue]

;View the queue
<source lang=bash>
mailq # ... or ...
postqueue -p
</source>

;View a message
<source lang=bash>
postcat -vq XXXXXXXXXX # Replace XXXXXXXXXX with message ID
</source>

;Process the queue now
<source lang=bash>
postqueue -f # ... or ...
postfix flush
</source>

;Delete the queue
<source lang=bash>
postsuper -d ALL
postsuper -d ALL deferred # Delete only deferred messages
</source>
</source>

Revision as of 12:27, 5 September 2016

References

Aliases

Add static aliases in default configuration

  • Edit /etc/aliases
  • Then run newaliases:
newaliases

Uses regexp (dynamic) aliases

Edit file /etc/postfix/main.cf as follows [1]:

alias_maps = regexp:/etc/postfix/aliases-regexp

Then create /etc/postfix/aliases-regexp as follows:

/^tom\..*@domain.com$/     tom@other.com
/^phil\..*@domain.com$/    phil@other.com

Troubleshooting

Debugging aliases

Use postmap:

postmap -q mip@prime.immie.org hash:/etc/aliases regexp:/etc/aliases-regexp
postmap -q mip hash:/etc/aliases regexp:/etc/aliases-regexp

Handling deferred mail / message queue

Reference:

View the queue
mailq                        # ... or ...
postqueue -p
View a message
postcat -vq XXXXXXXXXX       # Replace XXXXXXXXXX with message ID
Process the queue now
postqueue -f                 # ... or ...
postfix flush
Delete the queue
postsuper -d ALL
postsuper -d ALL deferred    # Delete only deferred messages