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
Using your favorite editor open the configuration file located at /etc/pmta/config
.
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 source
s:
<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>
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 file
s:
<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>
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