Postfix
From Luke Jackson
Revision as of 00:56, 6 June 2012 (edit) Ljackson (Talk | contribs) (→Command To Know) ← Previous diff |
Current revision (06:53, 17 September 2020) (edit) Ljackson (Talk | contribs) (→Sources) |
||
Line 19: | Line 19: | ||
mail.server.ext RELAY | mail.server.ext RELAY | ||
</pre> | </pre> | ||
+ | |||
+ | === Comcast requires that all mail servers must have a PTR record with a valid Reverse DNS entry. === | ||
+ | |||
+ | "Currently your mail server does not fill that requirement." - For more information, refer to: http://postmaster.comcast.net/smtp-error-codes.php#554 | ||
+ | |||
+ | '''[Solved] Changing Postfix Outbound IP Address''' | ||
+ | |||
+ | Changing Postfix Outbound IP Address | ||
+ | |||
+ | When a server has more than one IP address assigned to it, Postfix randomly selects an IP address for outbound emails. This default Postfix behavior can result in emails being listed as spam due to the sending IP not matching the IP address to which the server hostname is resolving. | ||
+ | |||
+ | The solution is to bind Postfix to the server's primary IP, or the IP to which the server's hostname is resolving. | ||
+ | |||
+ | Using your favorite text editor, open the Postfix configuration file: | ||
+ | vim /etc/postfix/main.cf | ||
+ | Add the line: | ||
+ | smtp_bind_address = 192.168.0.1 | ||
+ | Where 192.168.0.1 has to be replaced with the primary IP address of the server. | ||
+ | |||
+ | Then, restart Postfix: | ||
+ | /etc/init.d/postfix restart | ||
+ | |||
+ | |||
=== Command To Know === | === Command To Know === | ||
Line 34: | Line 57: | ||
=== Empty Mail Queue === | === Empty Mail Queue === | ||
- | mailq | ||
postsuper -d ALL | postsuper -d ALL | ||
+ | postsuper -d ALL deferred | ||
=== Postfix Script (PHP) === | === Postfix Script (PHP) === | ||
Line 67: | Line 90: | ||
* http://jeroensmeets.net/setup-postfix-to-forward-incoming-email-to-php/ | * http://jeroensmeets.net/setup-postfix-to-forward-incoming-email-to-php/ | ||
+ | * https://www.cyberciti.biz/tips/howto-postfix-flush-mail-queue.html | ||
[[Category:Linux]] | [[Category:Linux]] |
Current revision
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
Comcast requires that all mail servers must have a PTR record with a valid Reverse DNS entry.
"Currently your mail server does not fill that requirement." - For more information, refer to: http://postmaster.comcast.net/smtp-error-codes.php#554
[Solved] Changing Postfix Outbound IP Address
Changing Postfix Outbound IP Address
When a server has more than one IP address assigned to it, Postfix randomly selects an IP address for outbound emails. This default Postfix behavior can result in emails being listed as spam due to the sending IP not matching the IP address to which the server hostname is resolving.
The solution is to bind Postfix to the server's primary IP, or the IP to which the server's hostname is resolving.
Using your favorite text editor, open the Postfix configuration file:
vim /etc/postfix/main.cf
Add the line:
smtp_bind_address = 192.168.0.1
Where 192.168.0.1 has to be replaced with the primary IP address of the server.
Then, restart Postfix:
/etc/init.d/postfix restart
Command To Know
postfix flush
postmap <file>
mailq
cat /var/log/mail.log
/etc/init.d/postfix reload
Empty Mail Queue
postsuper -d ALL postsuper -d ALL deferred
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