Showing posts with label MTA. Show all posts
Showing posts with label MTA. Show all posts

Sunday, April 21, 2024

Exim configuration & Filter

 There are two things that need to be configured. The system filter and the specific transport. If you only want to forward emails and not save them to the filesystem, the transport section is not needed.

Edit your exim configuration and add these lines at the top:

# /etc/exim.conf top

system_filter = /etc/system_filter.exim

system_filter_directory_transport = local_copy_outgoing

Add these lines lower in the configuration, in your transports section:

# /etc/exim.conf transpors section


  driver = appendfile




  group = mail

  user = mail

  mode = 0660

  maildir_format = true

  create_directory = true

Change the mail user to the specific user account on your system exim runs at. It could be named exim. You can check that with the getent passwd command.

To configure the actual saving and filtering create or edit the /etc/system_filter.exim file. The below snippets should be placed in that file, according to what you're trying to acomplish.

To save all outgoing mail from a specific domain to a maildir folder in /var/mail/:

if $sender_address_domain is example.tld


unseen save /var/mail/example.tld/mailarchive/.${tr{$sender_address}{.}{_}}.outgoing/


Forward all outgoing from specific domain to specific email address:

if $sender_address_domain is example.tld


unseen deliver


Forward ALL outgoing mail to email address:

unseen deliver

Save ALL outgoing email to maildir folder:

unseen save /var/mail/${tr{$sender_address_domain}{.}{_}}/mailarchive/${tr{$sender_address}{.}{_}}.outgoing/

The files are saved in a maildir structure:

ls -la /var/mail/example.tld/mailarchive/example\@example.tld.outgoing/new/

total 16

-rw-rw---- 1 mail mail 1632 Dec 15 20:31 1450207897.H829447P10443.example.tld

drwx------ 5 mail mail 4096 Dec 15 20:31 ..

-rw-rw---- 1 mail mail 1747 Dec 15 20:33 1450207983.H51962P10484.example.tld

drwx------ 2 mail mail 4096 Dec 15 20:33 .

Ref: Exim Documentation

Saturday, February 11, 2023

Add Domain specific DKIM in PMTA config


<virtual-mta ip1>

    smtp-source-host host.domain.tld

    <domain *>

        max-msg-rate 400/h



#DKIM Keys

domain-key key1,domain1.tld,/etc/pmta/keys/key1.domain.tld

domain-key key2,domain2.tld,/etc/pmta/keys/key2.domain.tld

domain-key key3,domain3.tld,/etc/pmta/keys/key3.domain.tld

#Specify the DKIM for specific Domain using Directive

<domain domain1.tld>

    dkim-sign yes

    smtp-hosts []:587

    dkim-identity @domain1.tld


<domain domain2.tld>

    dkim-sign yes

    smtp-hosts []:587

    dkim-identity @domain2.tld


<domain domain3.tld>

    dkim-sign yes

    smtp-hosts []:587

    dkim-identity @domain3.tld


#CALL PMTA POOL for Rotation

<virtual-mta-pool pmta-pool>

    virtual-mta ip1


Saturday, August 6, 2022

How to hide IP in header from Postal MTA

Remove  text where need using the following file in postalMTA.

For SMTP Server:


@receiving_headers = true
received_header_content = "from #{@helo_name} (#{@hostname} [#{@ip_address}]) by #{Postal.config.dns.smtp_server_hostname} with SMTP;



mail.header['Received'] = "from #{@source_type} (#{self.resolved_hostname} [#{@ip}]) by Postal with HTTP; #{}"
mail.message_id = "<#{@message_id}>"

Saturday, June 11, 2022

PowerMTA System requirements

It depends on how big your email lead list is. For example, if you want to send 10000/hour emails , the optimum server would have 10 IPs and would be using 10 domains or subdomains. This way each IP/domain would send emails1000/hour. The more IPs and domains the better variety can be applied as follows.

Minimum system requirements for sending from 1 IP/domain:

  • VPS (KVM, OpenVZ, XEN, …)
  • CentOS 6 x64 minimal
  • 1 core
  • 1 GB RAM
  • 10 GB HDD
  • 1 IP

I theory a server like this could also be used with more IPs and domains but could get to its peak point.
Here are recommended system requirements based on number of used IPs/domains
Local PowerMTA

Everything will run on the same server so our server must have enough power. Here are our recommendations:

5-19 IPs/domains

  • VPS or Dedicated server
  • 2 cores
  • 8 GB RAM
  • 20 GB SSD
20-99 IPs/domains

  • VPS or Dedicated server
  • 4 cores
  • 16GB RAM
  • 40 GB SSD
100+ IPs/domains

  • VPS or Dedicated server
  • 8 cores
  • 32GB RAM
  • 100 GB SSD
Here a saying we all know from Jeremy Clarkson would come in handy, POWER!!!! And more power we have the better.

External PowerMTA
In this case, Mumara will run on one more powerful server and PowerMTA will be installed on many cheaper servers. Here are our recommendations:

Main server – Mumara

  • 4 cores
  • 16GB RAM
  • 40 GB SSD
  • 1 IP

MTAs – PowerMTA
  • 1 core
  • 1 GB RAM
  • 10 GB HDD
  • 1 IP
This guideline covers both scenarios.

Saturday, August 28, 2021

How to uninstall or remove dovecot-core software from Ubuntu

sudo apt-get remove dovecot-core
sudo apt-get remove --auto-remove dovecot-core
sudo apt-get purge dovecot-core
sudo apt-get purge --auto-remove dovecot-core

Tuesday, August 10, 2021

How to install Postal MTA using Docker & Caddy server in Ubuntu 18.04

Step-1: Hostname Setup

sudo hostname

Step-2: Docker

sudo apt-get update

sudo apt-get install \

    apt-transport-https \

    ca-certificates \

    curl \

    gnupg \


curl -fsSL | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

echo \

  "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] \

  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

sudo apt-get update

sudo apt-get install docker-ce docker-ce-cli

sudo curl -L "$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

sudo chmod +x /usr/local/bin/docker-compose

docker-compose --version

Step-3: System utilties

apt install git curl jq

Step-4: Git & installation helper repository

git clone /opt/postal/install

sudo ln -s /opt/postal/install/bin/postal /usr/bin/postal

Step-5: MariaDB

docker run -d \

   --name postal-mariadb \

   -p \

   --restart always \

   -e MARIADB_DATABASE=postal \



Step-6: RabbitMQ

docker run -d \

   --name postal-rabbitmq \

   -p \

   --restart always \





Step-7: Installation postal

postal bootstrap

Step-8: DB Config and Permission (This is optional if you use step-5)

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';

GRANT ALL ON postal.* TO 'postal'@'localhost' WITH GRANT OPTION;



sudo nano /opt/postal/config/postal.yml

Step-9: DB initialise

postal initialize

postal make-user

Step-10: Postal Running

postal start

Step-11: Installing WEB Client

docker run -d \

   --name postal-caddy \

   --restart always \

   --network host \

   -v /opt/postal/config/Caddyfile:/etc/caddy/Caddyfile \

   -v /opt/postal/caddy-data:/data \


Step-12: STPM Configure


Postal Login Credentials


Mr X.


Password: **********


docker run -d \

   --name postal-caddy \

   --restart always \

   --network host \

   -v /opt/postal/config/Caddyfile:/etc/caddy/Caddyfile \

   -v /home/postal/public_html/caddy-data:/data \


sudo /etc/init.d/apache2 start

sudo /etc/init.d/apache2 stop


Postal stop

Postal start

How to merge a branch to main branch in Github.

In Terminal or Command Prompt:  git checkout main  [switch to main branch] git pull origin main  [grab latest updates from main branch] git ...