BreadCrumbs: Postfix

Postfix

From Luke Jackson

(Difference between revisions)
Jump to: navigation, search
Revision as of 20:54, 13 January 2011 (edit)
Ljackson (Talk | contribs)
(Postfix Script (PHP))
← Previous diff
Revision as of 00:56, 6 June 2012 (edit)
Ljackson (Talk | contribs)
(Command To Know)
Next diff →
Line 23: Line 23:
postfix flush postfix flush
- postmap+ 
 + postmap <file>
 + 
mailq mailq
 +
cat /var/log/mail.log cat /var/log/mail.log
 +
/etc/init.d/postfix reload /etc/init.d/postfix reload
 +
 +=== Empty Mail Queue ===
 +
 + mailq
 + postsuper -d ALL
=== Postfix Script (PHP) === === Postfix Script (PHP) ===
 +
 +*Create script to parse incoming mail*
<pre> <pre>
Line 35: Line 46:
?> ?>
</pre> </pre>
 +
 +*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 ===
* http://jeroensmeets.net/setup-postfix-to-forward-incoming-email-to-php/ * http://jeroensmeets.net/setup-postfix-to-forward-incoming-email-to-php/
[[Category:Linux]] [[Category:Linux]]

Revision as of 00:56, 6 June 2012

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