BreadCrumbs: Postfix

Postfix

From Luke Jackson

(Difference between revisions)
Jump to: navigation, search
Revision as of 06:45, 17 September 2020 (edit)
Ljackson (Talk | contribs)
(FAQ)
← Previous diff
Revision as of 06:50, 17 September 2020 (edit)
Ljackson (Talk | contribs)
(Empty Mail Queue)
Next diff →
Line 57: 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) ===

Revision as of 06:50, 17 September 2020

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

Sources

Personal tools