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:

This document focuses on how Postfix manipulates email addresses. It covers:

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.

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.

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.

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.

No code examples are applicable for this overview document.

DATABASE_README.txt

This document provides an overview of Postfix lookup tables.

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.

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.

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.

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.

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.

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.

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.

Code Example:

A user's .forward file:

"|/path/to/maildrop -d ${USER}"

MEMCACHE_README.txt

This document explains how to use Memcached with Postfix.

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.

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.

Code Example:

Listing all Postfix instances:

# postmulti -l

MYSQL_README.txt

This document explains how to use MySQL with Postfix.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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!