Introduction
This article describes how to install & configure the SMTP Translator plugin.
Description
This article will describe how to install SMTP Translator plugin
1. Installation that should be done in all cases/modes.
2. Incoming email configuration
3. Outgoing email configuration (Gateway or MX mode)
4. SYSTRAN Settings
5. Tests & validation
Flow diagram:
1. Installation
Online installation
Add the systran-ses-plugin repository to your systranrpm.repo file then install it
yum install systran-smtp-translator
Offline installation
Download the systran-smtp-translator rpm package from TRS then install it
yum install systran-smtp-translator*.rpm
Enable the service
Once systran-smtp-translator is installed, you need to enable this new component in the system:
systemctl enable systran-smtp-translator.service
2. Incoming email configuration
Ask to IT admin:
a) Either to add a rule in the company mail server to forward all emails sent to translate_XX_XX@company.com (XX could be any 2 character ISO language code) to SYSTRAN server.
For advanced usage, you can also ask redirection of translate_XX_XX_XXXXXXXX-XXXX-XXXXXXXXX-XXXXXXXXXXXX@company.com emails to SYSTRAN server (XXXXXXXX-XXXX-XXXXXXXXX-XXXXXXXXXXXX for a specific profile ID)
(for o365, could be done following https://docs.microsoft.com/en-us/exchange/mail-flow-best-practices/use-connectors-to-configure-mail-flow/set-up-connectors-to-route-mail)
b) Either to set-up MX to allow SYSTRAN server to receive emails sent to that domain. Ask to IT admin to update DNS and set a MX record translate.company.com associated to SYSTRAN server IP address. In that case, all emails sent to translate.company.com will be received by SYSTRAN server, translated and sent back to user.
2.1 Ensure server can receive incoming email
2.1.1 Define sender domain:
Whatever the option above choosen, edit the /opt/systran/smtp-translator/config/host_list file then ensure mail domain name is white listed:
translate.company.com
2.1.2 Option 1, listen on port 25
Firewall should be open for 25:
firewall-cmd --permanent --zone=public --add-port=25/tcp
firewall-cmd --reload
Edit the file /opt/systran/smtp-translator/config/smtp.ini and change following entry:
listen=[::0]:25
As Node is not authorized to bind socket below 1024. In that case, type following command:
setcap 'cap_net_bind_service=+ep' `which node`
Then restart systran-smtp-translator service:
systemctl restart systran-smtp-translator
Note:
In case systran-smtp-translator or firewalld service do not start/restart, this is most probably because TCP 25 is already in use. To check TCP 25 port usage:
netstat -anp | grep :25
You could find postfix process running and binding :25 socket. In that case, stop & disable it:
systemctl stop postfix systemctl disable postfix
In case server do not support IPv6 (service crash) then open IPv4 in smtp.ini:
listen=0.0.0.0:25
2.1.3 Option 2, redirect external port 25 to internal 8025 port
Ensure service is listening on port 8025 (default) in /opt/systran/smtp-translator/config/smtp.ini:
listen=[::0]:8025
Add the port redirection using following command:
firewall-cmd --permanent --zone=public --add-forward-port=port=25:proto=tcp:toport=8025
Then reload firewall config:
firewall-cmd --reload
2.1.4 Option 3, listen on port 8025 or any other port
Edit the file /opt/systran/smtp-translator/config/smtp.ini and change following entry:
listen=[::0]:8025
Firewall should be open for 8025:
firewall-cmd --permanent --zone=public --add-port=8025/tcp
firewall-cmd --reload
3. Outgoing email configuration
3.1 Set-up Gateway mode
Edit the file /opt/systran/smtp-translator/config/default.yaml file then check following entries in bold and update according to your settings:
email: mode: gateway # mx or gateway, for mx, the port 25 must be opened
options:
service:
port: 25 # mandatory (update according to your company settings)
host: [company SMTP server] # mandatory could be an IP or FQDN
secure:
auth:
ignoreTLS:
name:
localAddress:
connectionTimeout:
greetingTimeout:
socketTimeout:
debug:
authMethod:
tls:
3.2 Set-up MX mode
Edit the file /opt/systran/smtp-translator/config/default.yaml file then check following entries:
email: mode: mx # mx or gateway, for mx, the port 25 must be opened
options:
...
4. SYSTRAN Settings
4.1 Define SYSTRAN translation server connection
Edit the file /opt/systran/smtp-translator/config/default.yaml file then check following entries:
url: https://localhost:8904/translation/file/translate
...
user:
apikey: <a_valid_api_key> (the apikey should match to a use whoc can access to requested translation profiles)
Set SYSTRAN Gateway port 8903 or 8904 according to your default.
If https is enabled: 8904 as redirection is not supported.
4.2 Define content to be translate
By default, subject, body and attachments are translated:
translationSkippedParts:
body: false
subject: false
attachment: false
4.2 Define incoming email format (optional)
By default, translate_XX_YY@domain or translate_XX_YY_[Profile_ID]@domain are used where XX is source language and YY is target language. [Profile_ID] is optional.
rcptUserFormatOptions:
separator: "_" # Quote this for special characters
prefix: translate
4.2 Restrict email translation to a list of servers
Activate restriction by source DNS or IP:
echo "lookup_rdns.strict" >> /opt/systran/smtp-translator/config/plugins
Fill the withlst of serveur authorized to translate emails:
echo "smpt.company.com" >> /opt/systran/smtp-translator/echo "lookup_rdns.strict" >> config/lookup_rdns.strict.whitelist
5. Tests & validation
To test implemtation, you can send an email from a end user account. You can also use swaks toolikt to validate the complete workflow from the server prompt: SMTP Translator Mail reception > Mail translation > SMTP Translator Reponse Mail sending.
Tests & validation using swaks toolikt:
Install swaks using following command:
yum install swaks
We'll use following entries for testing:
- Source address: systran@systran.net
- Destination address : translate_fr_en@translate.company.com
- Mail Subject: "Bonjour"
On the server, launch the following command:
swaks -f systran@systran.net -t translate_fr_en@translate.company.com -s [Server public IP] -p [port: 25 or 8025]--header "Subject: Bonjour"
After launching the command, you should see correct entries:
[...]
-> MAIL FROM:<systran@systran.net>
<- 250 sender <systran@systran.net> OK
-> RCPT TO:<translate_en_fr@translate.company.com>
<- 250 recipient <translate_en_fr@translate.company.com> OK
[...] <- 250 Message Queued (36EB29E3-BE0B-40EC-8FD4-C25EBF1686C7.1)
That means first mail had been correctly sent to SES. Now you can check if translation is going fine and if response mail had been sent.
Open the systran-smtp-translator journal log
journalctl -u systran-smtp-translator
Then check if there is some translation activity. You can see it checking nb_characters, nb_tokens, nb_tus keyword.
Then you should see the correct delivery of mail response:
[data.translate] Sending Mail from translate_fr_en_068a98f7-81d3-4883-b760-a604b607d4da@translate.company.com to: systran@systran.net [data.translate] Send email OK
Note that emails have to be sent in UTF8. To force Outlook to send email using UTF8 encoding, please go in File, Option then Advanced Settings.