EmailElement Docs

PowerMTA

PowerMTA

To complete the integration, you will need to set up the PowerMTA account file configuration and Logstash installation on the pmta server. We recommend version Logstash 8.17.0 or higher.

Supported Versions: PowerMTAâ„¢ v5.0r3 and above

Prerequisites

  • PowerMTA installed and running, with an SMTP listener configured.
  • Your firewall allowing inbound SMTP from EmailElement.
  • The sending domain authenticated in DNS, with SPF and DKIM records in place.
  • Port 25 or 587 reachable from EmailElement's addresses.

Updating Configuration File

Using your favorite editor open the configuration file located at /etc/pmta/config.

Source configuration /Smtp Relay Hosts

To allow EmailElement to send emails using your MTA, our IPs will need to be added as a source.

To accomplish this, please add the following IPs: 38.74.128.59, 64.62.168.6 and, 8.45.58.31 as sources:

<source 38.74.128.59>
    always-allow-relaying yes   # allow feeding from emailelement ip 38.74.128.59
    process-x-virtual-mta yes   # allow selection of virtual MTA
    max-message-size unlimited
    smtp-service yes            # allow SMTP service
</source>

<source 64.62.168.6>
    always-allow-relaying yes   # allow feeding from emailelement ip 64.62.168.6
    process-x-virtual-mta yes   # allow selection of virtual MTA
    max-message-size unlimited
    smtp-service yes            # allow SMTP service
</source>
<source 8.45.58.31>
    always-allow-relaying yes   # allow feeding from emailelement ip 8.45.58.31
    process-x-virtual-mta yes   # allow selection of virtual MTA
    max-message-size unlimited
    smtp-service yes            # allow SMTP service
</source>

Set Up Account File / Webhook for Email Tracking

In order for EmailElement to track your deliveries, we will need to receive delivery events from your MTA.

To accomplish this, we will output the content a log file using the account files:

<acct-file /var/log/pmta/eelog.csv>
    records b,d,t
    record-fields b timeLogged,rcpt,dlvSourceIp,dlvDestinationIp,header_Message-Id,dsnDiag,bounceCat,timeQueued,orig
    record-fields d timeLogged,rcpt,dlvSourceIp,dlvDestinationIp,header_Message-Id,dsnDiag,bounceCat,timeQueued,orig
    record-fields t timeLogged,rcpt,dlvSourceIp,dlvDestinationIp,header_Message-Id,dsnDiag,bounceCat,timeQueued,orig

    move-interval 2m
    max-size 2M
    world-readable true
</acct-file>

Install Logstash

Next, we need to install Logstash to send the log file content's to EmailElement's webhook.

Check/ install java

yum install java-1.8.0-openjdk.x86_64

Import Public Signing key

rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch

Create repo file

echo "deb [signed-by=/usr/share/keyrings/elastic-keyring.gpg] https://artifacts.elastic.co/packages/8.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-8.x.list

Install logstash

sudo yum install logstash

Allow logstash access to powermta files

usermod -a -G pmta logstash

Add emailelement logstash config file to conf.d directory. Config filename: emailelement.conf

cd /etc/logstash/conf.d
vi emailelement.conf

Contents of emailelement.conf

    input {
    stdin { }
    file {
		    path => "/var/log/pmta/eelog*"
	    }
    }
    output {
    http {
		    id => "emailelement"
		    url => 'https://deliverywebhook.emailelement.com/api/event/form/powermta'
		    http_method => post
		    retry_non_idempotent => true
		    format => json_batch
		    automatic_retries => 2
	    }
    stdout{ }
    }
    filter {
    mutate { remove_field => "host" }
    mutate { remove_field => "@version" }
    mutate { remove_field => "event" }
    mutate { remove_field => "log" }
    }

Start logstash and allow logstash run on reboot

systemctl start logstash
systemctl enable logstash

Check if Logstash running

sudo service logstash status

Check Logstash logs for toubleshooting

cd /var/log/logstash
cat logstash-plain.log

Check Logstash version

bin/logstash --version

Set Up PowerMTA in EmailElement

  1. Go to Send Integrations and click Create Send Integration.

  2. Choose SMTP as the integration type, pick PowerMTA, and click Next.

  3. Give the integration a name.

  4. Select one or more sender domains. A green tick means the domain is validated.

  5. Fill in the connection:

    Field Value
    Hostname Your PowerMTA server's IP address or hostname
    Port 25 or 587
    Security Type TLS is recommended
    Username Your SMTP username, if you configured authentication
    Password Your SMTP password, if you configured authentication
  6. Click Create.

Test the Integration

  1. Click Run Test on the new integration.
  2. The result is shown per domain under Sender Domains.
  3. At least one domain has to pass before the integration will send.

Troubleshooting

Issue What it means Fix
Connection refused The firewall is blocking the port Open port 25 or 587 to EmailElement's addresses
Authentication failed The credentials do not match Check the SMTP user configuration in PowerMTA
TLS handshake failed A certificate problem Check the certificate is valid, or try a different security type
Test times out A network or routing problem Check the hostname resolves, and trace the route to it
Email queued but not sending A VirtualMTA binding problem Check the queue status and the VirtualMTA configuration

Logs are in /var/log/pmta/. The SMTP session log shows connection attempts from EmailElement, and the accounting log shows delivery attempts and what came back.

To check the server itself:

# Test the SMTP connection
telnet your-pmta-server 587

# PowerMTA status
pmta show status
Something went wrong. Reloading the page usually fixes it. Reload ×

Rejoining the server...

Rejoin failed... trying again in seconds.

Failed to rejoin.
Please retry or reload the page.

The session has been paused by the server.

Failed to resume the session.
Please retry or reload the page.