BreadCrumbs: MediaWiki:Talkpage : Special:Contributions : Control Userpasswords2 : Special:Search : Postfix
Postfix
From Luke Jackson
(Difference between revisions)
Revision as of 23:42, 11 July 2007 (edit) Ljackson (Talk | contribs) ← Previous diff |
Revision as of 00:56, 6 June 2012 (edit) Ljackson (Talk | contribs) (→Command To Know) Next diff → |
||
Line 3: | Line 3: | ||
=== Deferred: Connection refused by [127.0.0.1] === | === Deferred: Connection refused by [127.0.0.1] === | ||
+ | Please uninstall sendmail and then restart Postfix. | ||
+ | /etc/mail/access | ||
<pre> | <pre> | ||
Line 17: | Line 19: | ||
mail.server.ext RELAY | mail.server.ext RELAY | ||
</pre> | </pre> | ||
+ | |||
+ | === 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* | ||
+ | |||
+ | <pre> | ||
+ | <?php | ||
+ | $data = file_get_contents("php://stdin"); | ||
+ | ?> | ||
+ | </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/ | ||
[[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