BreadCrumbs: Postfix
Postfix
From Luke Jackson
(Difference between revisions)
Revision as of 20:54, 13 January 2011 (edit) Ljackson (Talk | contribs) (→Postfix Script (PHP)) ← Previous diff |
Revision as of 20:56, 13 January 2011 (edit) Ljackson (Talk | contribs) (→Postfix Script (PHP)) Next diff → |
||
Line 29: | Line 29: | ||
=== Postfix Script (PHP) === | === Postfix Script (PHP) === | ||
+ | |||
+ | *Create script to parse incoming mail* | ||
<pre> | <pre> | ||
Line 35: | Line 37: | ||
?> | ?> | ||
</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 20:56, 13 January 2011
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 mailq cat /var/log/mail.log /etc/init.d/postfix reload
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