Laravel Mail Configuration with postfix
This is the top-level index for the Postfix documentation. Think of it as the table of contents. It gives an overview of all the different aspects of Postfix. It's divided into sections:
- General configuration This covers the basic setup, SOHO setups, standard configurations, address rewriting, virtual domain hosting, SASL, and TLS.
- Problem-solving Includes bottleneck analysis, stress-dependent configuration, performance tuning, and debugging.
- Content inspection Discusses content inspection, backscatter, built-in filters, after-queue filters, before-queue filters, and Milter applications.
- SMTP relay and access control Covers relay and access control, access policy delegation, address verification, restriction classes, connection triage, ETRN, and UUCP.
- Lookup tables (databases) Details various database lookups like Berkeley DB, CDB, LDAP, LMDB, Memcache, MongoDB, MySQL, PCRE, PGSQL, and SQLite.
- Mailing list support Includes VERP.
- Specific environments Covers Linux and NFS issues.
- Other mail delivery agents Includes maildrop.
- Other topics Covers architecture,
postconf(5)
parameters, local recipients, address classes, connection cache, DSN, BDAT, package building, scheduler, XCLIENT, and XFORWARD commands.
This document focuses on how Postfix manipulates email addresses. It covers:
- Address manipulations via the
smtp(8)
delivery agent: Generic mapping for outgoing SMTP mail. - Address manipulations via the
local(8)
delivery agent: local alias database, per-user.forward
files, and local catch-all addresses. - Resolving addresses: How Postfix determines the transport and next-hop destination.
- Mail Delivery Reports: This document also explains what information is included in mail delivery reports. Specifically, the envelope sender and recipient addresses, and any changes Postfix made to these.
Code Example:
Let's say you want to rewrite all outgoing mail from user@olddomain.com
to user@newdomain.com
.
/etc/postfix/main.cf
:
smtp_generic_maps = hash:/etc/postfix/generic
/etc/postfix/generic
:
user@olddomain.com user@newdomain.com
After modifying the file, use postmap /etc/postfix/generic
and restart Postfix.
This document explains Postfix support for the BDAT command, which is part of the CHUNKING extension in SMTP. This allows for sending large emails in multiple chunks, which makes sending large attachments more efficient.
- The document shows the use of the BDAT command in an SMTP session.
- It also discusses options for handling binary content, which includes converting to 8-bit text, 7-bit forms like base64 or quoted-printable, or returning email as undeliverable. It notes that such conversion will break digital signatures.
- It also discusses the downsides of CHUNKING regarding client command pipelining.
Code Example:
An SMTP session with BDAT
:
S: 250-SIZE 153600000
S: 250-VRFY
S: 250-ETRN
S: 250-STARTTLS
S: 250-AUTH PLAIN LOGIN
S: 250-ENHANCEDSTATUSCODES
S: 250-8BITMIME
S: 250-DSN
S: 250-SMTPUTF8
S: 250 CHUNKING
C: MAIL FROM:<>
S: 250 2.1.0 Ok
C: RCPT TO:<>
S: 250 2.1.5 Ok
C: BDAT 10000
C: ...followed by 10000 bytes...
S: 250 2.0.0 Ok: 10000 bytes
C: BDAT 123
C: ...followed by 123 bytes...
...
BUILTIN_FILTER_README.txt
This document describes Postfix's built-in content inspection features.
- It explains that message headers with encoded non-ASCII characters need to be matched in their encoded form.
- It also notes that header/body checks cannot filter on a combination of message headers or body lines, but examine content one header or body line at a time.. Also, header/body checks cannot depend on the recipient.
- It also describes how to prevent daily mail status reports from being blocked.
- It shows how to put
pflogsumm
output into a base64 MIME attachment.
Code Example:
To block messages containing "badword" in the body:
/etc/postfix/main.cf
:
body_checks = regexp:/etc/postfix/body_checks
/etc/postfix/body_checks
:
/badword/ REJECT
After modifying the file, use postmap /etc/postfix/body_checks
and restart Postfix.
CDB_README.txt
This document covers how to use CDB (Constant DataBase) with Postfix.
- It describes the use of the "sequence" operation with
postmap -s
orpostalias -s
, which is only available when Postfix is built withtinycdb
. - CDB support is available with Postfix 2.2 and later.
Code Example:
Building Postfix with CDB Support (refer to the INSTALL document for a full procedure):
% make tidy
% make makefiles CCARGS="-DHAS_CDB" AUXLIBS="-lcdb"
% make
% make install
CONTENT_INSPECTION_README.txt
This document gives an overview of Postfix's content inspection methods.
- It describes the three methods:
- Before-queue, built-in, light-weight scanning.
- After-queue, external, heavy-weight scanning. This uses standard protocols like SMTP or "pipe to command".
- It mentions that
BACKSCATTER_README
has information on stopping backscatter mail.
No code examples are applicable for this overview document.
DATABASE_README.txt
This document provides an overview of Postfix lookup tables.
- It provides examples using
make
to manage database files. - It also describes the file format for
regexp
lookups. - It also states that
sdbm
is only available on systems with SDBM database support.
Code Example:
A Makefile
for managing Postfix databases:
all: aliases.db access.db virtual.db
aliases.db: aliases.in
postalias aliases.in
mv aliases.in.db aliases.db
access.db: access.in
postmap access.in
mv access.in.db access.db
virtual.db: virtual.in
postmap virtual.in
mv virtual.in.db virtual.db
DB_README.txt
This document explains Postfix support for Berkeley DB.
- It mentions that some UNIX systems use DBM files instead of Berkeley DB for historical reasons, and that DBM files have limited storage capacity.
- It provides a link to download and install Berkeley DB source code.
- It also warns against compiling Postfix with a different Berkeley DB implementation than system libraries or other third-party libraries as this can cause core dumps.
No code example provided as this document focuses on installation.
FORWARD_SECRECY_README.txt
This document explains how to configure forward secrecy with Postfix using TLS.
- It mentions that forward secrecy provides protection if a private key is compromised.
- It provides a list of ciphers that support forward secrecy.
- It also gives a command using
openssl
to display the ciphers. - It credits Lutz Ja"nicke, Wietse Venema, and Viktor Dukhovni for Postfix's TLS support.
Code Example:
Viewing ciphers that support forward secrecy:
$ openssl ciphers -v \
'aNULL:-aNULL:kEECDH:kEDH:+RC4:!eNULL:!EXPORT:!LOW:@STRENGTH' |
awk '{printf "%-32s %s\n", $1, $3}'
INSTALL.txt
This document details how to install Postfix from source code.
- It states that if you are using a pre-compiled version of Postfix you should start with
BASIC_CONFIGURATION_README
. - It describes how to build Postfix, including on supported systems, and porting to unsupported systems.
- It also explains how to configure Postfix to send mail only, to send and receive mail via a virtual interface, or to run Postfix instead of Sendmail.
- It covers mandatory configuration file edits and whether or not to chroot.
- It also covers how to install the software after compilation and how to use a compiler other than the default.
- It explains how to override default parameter settings and compile-time features.
- It explains how Postfix handles dynamically-linked libraries and database plugins.
- It also mentions that documentation is available as README files, HTML web pages, and UNIX-style manual pages.
- It also mentions that all Postfix source files have their own built-in manual page.
- It also explains how to get started building Postfix, and how to tidy the source tree.
- It also covers building with optional features such as third-party databases.
- It mentions that Postfix development happens on FreeBSD and MacOS X, with regular tests on Linux and Solaris.
- It also explains how to choose a SYSTEMTYPE name when porting Postfix to a new system.
- It mentions that non-interactive version of "make upgrade" needs
/etc/postfix/main.cf
. - It includes a grep command to inspect log files for specific error messages.
- It also includes
mailq
,sendmail -bp
, andpostqueue -p
as ways to inspect mail queues.
Code Example:
Building Postfix with MySQL and TLS support:
% make tidy
% make makefiles CCARGS="-DHAS_MYSQL -DHAS_TLS" AUXLIBS="-lmysqlclient -lssl -lcrypto"
% make
% make install
IPV6_README.txt
This document describes Postfix support for IPv6.
- It credits Dean Strik for his work on an IPv6 + TLS patch.
- It mentions that Wietse Venema merged Dean Strik's IPv6 patch into Postfix and removed IPv4 specific code where possible.
- It also notes that Postfix has a compatibility layer for systems without IPv6 support.
No specific code example is applicable here because this is a feature of the software.
LDAP_README.txt
This document explains how to configure Postfix with LDAP support.
- It notes that Postfix no longer supports the LDAP version 1 interface.
- It states that to use LDAP with Debian GNU/Linux, you only need to install the
postfix-ldap
package. - It credits Keith Stevenson, Samuel Tardieu, Sami Haahtinen, Victor Duchovni, and Liviu Daia for their contributions to Postfix LDAP support.
Code Example:
Building Postfix with LDAP support:
% make tidy
% make makefiles CCARGS="-DHAS_LDAP" AUXLIBS="-lldap -llber"
% make
% make install
LOCAL_RECIPIENT_README.txt
This document explains how Postfix handles local recipients, especially when you don't use the default local(8)
delivery agent.
- It notes that Postfix verifies the existence of recipients and attempts to return undeliverable mail to the sender.
No code examples are applicable here, this is more of an explanation of the system and what it does.
MAILDROP_README.txt
This document details how to integrate Maildrop with Postfix.
- It describes direct delivery without the local delivery agent and indirect delivery via the local delivery agent.
- It shows how to use a user's
.forward
file to pipe mail to Maildrop. - It credits Russell Mosemann, Victor Duchovni, and Tonni Earnshaw for their contributions.
Code Example:
A user's .forward
file:
"|/path/to/maildrop -d ${USER}"
MEMCACHE_README.txt
This document explains how to use Memcached with Postfix.
- It mentions that Wietse Venema wrote the current Memcache client for Postfix 2.9 from the ground up and that it doesn't use
libmemcache
.
No code examples provided as this focuses on the memcache implementation.
MONGODB_README.txt
This document explains how to use MongoDB as a lookup table with Postfix.
- It covers building Postfix with MongoDB support, configuring lookups, and provides examples for virtual alias maps, mailing lists, and MongoDB projections.
- It mentions that multiple mail servers can use the same information without copying it.
- It also notes that Postfix MongoDB client requires the
mongo-c-driver
library. - It provides an example of how to implement mailing lists using MongoDB.
- It credits Stephan Ferraro, Hamid Maadani, and Wietse Venema for their contributions.
Code Example:
Building Postfix with MongoDB support:
% make tidy
% make makefiles CCARGS="-DHAS_MONGODB" AUXLIBS="-lmongoc"
% make
% make install
MULTI_INSTANCE_README.txt
This document describes how to run multiple instances of Postfix.
- It explains why multiple instances are useful, for instance to separate different types of mail.
- It also explains the difference between null-client instances and service instances.
- It covers setting up the content-filter proxy.
- It details multi-instance configuration parameters and the use of the
postmulti(1)
command. - It also shows how to enable and list instances.
Code Example:
Listing all Postfix instances:
# postmulti -l
MYSQL_README.txt
This document explains how to use MySQL with Postfix.
- It credits Scott Cotton, Joshua Marcus, Liviu Daia, Jose Luis Tallon, and Victor Duchovni for their work on the MySQL implementation.
Code Example:
Building Postfix with MySQL support:
% make tidy
% make makefiles CCARGS="-DHAS_MYSQL" AUXLIBS="-lmysqlclient"
% make
% make install
OVERVIEW.txt
This document presents an architectural overview of Postfix.
- It explains how Postfix receives and delivers mail, including a description of the main processes.
- It describes the cleanup(8) server, which places messages in the incoming queue and notifies the queue manager.
- It explains the
trivial-rewrite(8)
server, which rewrites addresses. - It mentions that examples of delivery via the pipe(8) mailer are in
FILTER_README
,MAILDROP_README
, andUUCP_README
.
No specific code example as this is an overview document.
PACKAGE_README.txt
This document provides guidelines for package builders who create Postfix binary distributions.
- It recommends that the
main.cf
file be small and not list all the parameters. - It states that it is essential to provide README or HTML documentation files.
- It describes that Postfix installation is controlled by several installation parameters, which can be customized during compilation.
- It provides instructions on preparing a pre-built package for distribution.
- It also mentions that you can build Postfix package as an unprivileged user.
Code Example:
Creating a pre-built package:
% cd INSTALL_ROOT
% rm -f SOMEWHERE/outputfile
% find . \! -type d -print | xargs tar rf SOMEWHERE/outputfile
% gzip SOMEWHERE/outputfile
PCRE_README.txt
This document details how to use PCRE (Perl Compatible Regular Expressions) with Postfix.
- It mentions that for Debian based systems, all that is needed is to install
postfix-pcre
package.
Code Example:
Building Postfix with PCRE support:
% make tidy
% make makefiles CCARGS="-DHAS_PCRE" AUXLIBS="-lpcre"
% make
% make install
PGSQL_README.txt
This document explains how to use PostgreSQL with Postfix.
- It states that busy mail servers will generate many concurrent PostgreSQL clients, and it recommends running the PostgreSQL server with this in mind, or using Postfix's
proxymap(8)
service.
Code Example:
Building Postfix with PostgreSQL support:
% make tidy
% make makefiles CCARGS="-DHAS_PGSQL" AUXLIBS="-lpq"
% make
% make install
POSTSCREEN_3_5_README.txt, POSTSCREEN_README.txt
These documents describe how Postfix's postscreen(8)
service works.
- It explains how
postscreen(8)
is used to reduce spam volume by implementing a layered approach, using the less expensive defenses first. - It describes various tests, including quick tests before the 220 SMTP server greeting, tests after the greeting, and deep protocol tests.
- It mentions that when a good client passes the deep protocol tests, it is added to the temporary allowlist, but the connection isn't handed off in the middle of the session.
- It mentions various actions like
drop
,reject
, andignore
, that can be applied to the client. - It also mentions that many ideas in
postscreen(8)
were explored in earlier work by Michael Tokarev, in OpenBSD spamd, and in MailChannels Traffic Control.
No specific code example is applicable here, as this is a service within Postfix.
Pasted text
These are duplicates of some of the files already covered.
SASL_README.txt
This document covers how to use SASL (Simple Authentication and Security Layer) with Postfix.
- It notes that configuration files may belong to Postfix or the specific SASL implementation.
- It also states that the Cyrus SASL library has a lot of code and that Postfix's security is dependent on the security of the SASL library.
- It provides a table showing typical combinations of authentication backends and password verification services.
- It also provides a table listing authentication plugins provided by Cyrus SASL.
- It provides a list of properties that a SASL mechanism may have.
- It explains how to address common SASL authentication failures, such as "No worthy mechs found".
- It describes how to build Postfix with Cyrus SASL support.
- It credits Till Franke, Wietse Venema, Jason Hoos, and Liviu Daia for their contributions.
Code Example:
Building Postfix with Cyrus SASL support:
% make tidy
% make makefiles CCARGS="-DHAS_SASL" AUXLIBS="-lsasl2"
% make
% make install
SCHEDULER_README.txt
This document explains Postfix's queue scheduler, including concurrency scheduling and preemptive scheduling.
- It describes the limitations of earlier concurrency schedulers.
- It explains the Postfix 2.5 concurrency feedback algorithm, dead destination detection, and the pseudo-code for the concurrency scheduler.
- It presents results for delivery to concurrency-limited servers and a discussion of the tradeoffs.
- It covers the new queue manager and its preemptive scheduling algorithm.
- It goes into detail of data structures and what happens when the queue manager picks up a message.
- It also covers how the entry selection works, how preemption works, and how destination concurrency limits affect scheduling.
- It discusses how Postfix deals with memory resource limits when handling recipients.
- It credits Wietse Venema, Patrik Rak, and Victor Duchovni for their contributions to the queue manager.
No specific code example, as it focuses on the inner workings of the queue manager.
SMTPD_ACCESS_README.txt
This document describes how to configure access control for Postfix.
- It covers relay control, junk mail control, and per-user policies.
- It describes restrictions that apply to all SMTP mail, how to get selective with restriction lists, and delayed evaluation of those lists.
- It also covers dangerous use of
smtpd_recipient_restrictions
. - It also provides information on SMTP access rule testing.
No code example here since this is a general description of the service.
SMTPD_POLICY_README.txt
This document explains how to use policy daemons with Postfix.
- It covers policy protocol descriptions, basic and advanced configurations, and an example using greylisting.
- It mentions that policy daemons can be implemented in scripting languages like Perl or TCL.
- It provides examples of different parameters that are passed to the policy daemon.
- It also mentions that the policy daemon is used multiple times for up to
$max_use
incoming connections. - It explains the syntax for per-client settings which override global parameters.
Code Example:
A simple greylisting policy server in Perl:
#!/usr/bin/perl
use strict;
use warnings;
use DB_File;
my $database_name = "/var/mta/greylist.db";
my $greylist_delay = 60;
my $auto_allowlist_threshold = 10;
my %db;
tie %db, 'DB_File', $database_name, O_RDWR|O_CREAT, 0644 or die "Cannot open database: $!";
while (<STDIN>) {
chomp;
my @fields = split / /, $_;
my %attr;
for (@fields) {
if ($_ =~ /^([^=]+)=(.*)$/) {
$attr{$1} = $2;
}
}
my $key = join ':', $attr{client_address}, $attr{sender}, $attr{recipient};
if (exists $db{$key}) {
my ($first_seen, $count) = split /:/, $db{$key};
if (time() - $first_seen > $greylist_delay) {
$count++;
$db{$key} = join ':', $first_seen, $count;
if ($count > $auto_allowlist_threshold) {
print "action=ok\n\n";
} else {
print "action=ok\n\n";
}
} else {
print "action=defer_if_permit\n\n";
}
} else {
$db{$key} = join ':', time(), 1;
print "action=defer_if_permit\n\n";
}
}
untie %db;
SOHO_README.txt
This document provides hints and tips for small office/home office Postfix setups.
- It mentions that Postfix should work out of the box without change on a stand-alone machine that has direct Internet access.
- It provides instructions on how to set up Postfix on a machine that sends email through an ISP.
- It explains the use of
canonical_maps
to rewrite local addresses to ISP addresses, andvirtual_alias_maps
to deliver mail locally that was sent to the ISP address. - It recommends not to use real domain names for local setups, and recommends RFC 2606 for examples of domain names that can be used for local setups.
Code Example:
Configuration for a SOHO setup:
/etc/postfix/main.cf
:
myhostname = hostname.localdomain
mydomain = localdomain
canonical_maps = hash:/etc/postfix/canonical
virtual_alias_maps = hash:/etc/postfix/virtual
/etc/postfix/canonical
:
your-login-name your-account@your-isp.com
/etc/postfix/virtual
:
your-account@your-isp.com your-login-name
STANDARD_CONFIGURATION_README.txt
This document provides examples of typical Postfix configurations.
- It states that it should be reviewed after basic configuration steps in
BASIC_CONFIGURATION_README
. - It gives examples for a mailhub setup, where intranet mail is delivered directly and external mail is delivered through a gateway.
- It also gives an example where
smtp_generic_maps
rewrites addresses based on a mapping file. - It also shows the virtual setup as seen in the
SOHO_README
document.
Code Example:
Configuration for mailhub setup:
/etc/postfix/main.cf
:
transport_maps = hash:/etc/postfix/transport
relayhost =
/etc/postfix/transport
:
example.com :
.example.com :
* smtp:[gateway.example.com]
TLS_README.txt
This document explains how to use TLS (Transport Layer Security) with Postfix.
- It emphasizes the security implications of using OpenSSL and how the code should be scrutinized for bugs.
- It explains that
smtpd(8)
andsmtp(8)
implement TLS for the server side and client side respectively. - It explains that the
tlsmgr(8)
server maintains the pseudo-random number generator (PRNG). - It recommends that users review the
FORWARD_SECRECY_README
to take advantage of forward secrecy. - It provides logging levels for TLS activity.
- It also includes instructions on how to generate certificates and keys.
- It explains that client certificates should include all required certificates in the client certificate file, in the correct order.
- It describes building Postfix with TLS support.
Code Example:
Building Postfix with TLS support:
% make tidy
% make makefiles CCARGS="-DHAS_TLS" AUXLIBS="-lssl -lcrypto"
% make
% make install
VIRTUAL_README.txt
This document explains how to use Postfix for virtual domain hosting.
- It provides an overview on how to use Postfix for multiple internet domains, for both final delivery or forwarding.
- It covers local files vs. network databases for virtual setups.
- It also gives examples of virtual ALIAS setups with UNIX system accounts, and virtual MAILBOX setups with non-UNIX accounts.
- It explains that the
virtual_mailbox_base
parameter is used to specify the base directory for virtual mailboxes. - It also mentions that virtual mailboxes can be owned by a fixed UID and GID.
- It mentions that the virtual domain class is defined in the
ADDRESS_CLASS_README
file.
Code Example:
Configuration for virtual domain hosting with non-Postfix delivery agent:
/etc/postfix/main.cf
:
virtual_transport = ...see below...
virtual_mailbox_domains = example.com ...more domains...
XCLIENT_README.txt
This document describes how to use the XCLIENT
command with Postfix.
- It provides an example of an SMTP session using the XCLIENT command.
- The XCLIENT command is used to pass information from an intermediate server to a downstream server.
No specific code examples are available, other than the example SMTP dialogue.
That’s a substantial overview. Each of these could be expanded further, but this gives you a solid foundation for 750+ words of technical content. Remember to test any configuration changes on a development machine first. Let me know if you want to explore any of these topics in greater depth!