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

local_copy_outgoing:

  driver = appendfile

  delivery_date_add

  envelope_to_add

  return_path_add

  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

then

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

endif

Forward all outgoing from specific domain to specific email address:


if $sender_address_domain is example.tld

then

unseen deliver othermailbox@otherdomain.com

endif

Forward ALL outgoing mail to email address:


unseen deliver othermailbox@otherdomain.com

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

#MTAs

<virtual-mta ip1>

    smtp-source-host 192.198.0.1 host.domain.tld

    <domain *>

        max-msg-rate 400/h

    </domain>

</virtual-mta>

#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 [127.0.0.1]:587

    dkim-identity @domain1.tld

</domain>

<domain domain2.tld>

    dkim-sign yes

    smtp-hosts [127.0.0.1]:587

    dkim-identity @domain2.tld

</domain>

<domain domain3.tld>

    dkim-sign yes

    smtp-hosts [127.0.0.1]:587

    dkim-identity @domain3.tld

</domain>

#CALL PMTA POOL for Rotation

<virtual-mta-pool pmta-pool>

    virtual-mta ip1

</virtual-mta-pool>


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:

lib/postal/smtp_server/client.rb

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

For HTTP:

app/models/outgoing_message_prototype.rb

mail.header['Received'] = "from #{@source_type} (#{self.resolved_hostname} [#{@ip}]) by Postal with HTTP; #{Time.now.utc.rfc2822.to_s}"
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 postal.example.com

Step-2: Docker

sudo apt-get update

sudo apt-get install \

    apt-transport-https \

    ca-certificates \

    curl \

    gnupg \

    lsb-release

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

echo \

  "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \

  $(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 containerd.io

sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(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 https://postalserver.io/start/install /opt/postal/install

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

Step-5: MariaDB

docker run -d \

   --name postal-mariadb \

   -p 127.0.0.1:3306:3306 \

   --restart always \

   -e MARIADB_DATABASE=postal \

   -e MARIADB_ROOT_PASSWORD=postal \

   mariadb

Step-6: RabbitMQ

docker run -d \

   --name postal-rabbitmq \

   -p 127.0.0.1:5672:5672 \

   --restart always \

   -e RABBITMQ_DEFAULT_USER=postal \

   -e RABBITMQ_DEFAULT_PASS=postal \

   -e RABBITMQ_DEFAULT_VHOST=postal \

   rabbitmq:3.8

Step-7: Installation postal

postal bootstrap mailer.justnutritive2.com

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;

FLUSH PRIVILEGES;

Exit;

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 \

   caddy

Step-12: STPM Configure

https://postal.justnutritive2.com

-----------------------------------------

Postal Login Credentials

-----------------------------------------

Mr X.

https://postal.example.com/settings

Username: alexise@example.com

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 \

   caddy

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 ...