BreadCrumbs: Postfix

Postfix

From Luke Jackson

Jump to: navigation, search

Contents

FAQ

Deferred: Connection refused by [127.0.0.1]

Please uninstall sendmail and then restart Postfix.

/etc/mail/access

# Check the /usr/share/doc/sendmail/README.cf file for a description
# of the format of this file. (search for access_db in that file)
# The /usr/share/doc/sendmail/README.cf is part of the sendmail-doc
# package.
#
# by default we allow relaying from localhost...
localhost.localdomain           RELAY
localhost                       RELAY
127.0.0.1                       RELAY
mail.server.ext                 RELAY

Command To Know

postfix flush
postmap <file>
mailq
cat /var/log/mail.log
/etc/init.d/postfix reload

Empty Mail Queue

mailq
postsuper -d ALL

Postfix Script (PHP)

  • Create script to parse incoming mail*
<?php
  $data = file_get_contents("php://stdin");
?>
  • Add a new email address to Postfix configuration*
vi /etc/aliases
  • Add the following line (everything on one line)*
email+to+redirect: "| php -q /home/user/full/path/to/your/new/script.php"
  • Apply the changes to the aliases by running*
newaliases
  • Reload Postfix and Restart*
/etc/init.d/postfix reload
/etc/init.d/postfix restart

Sources

Personal tools