SmtpService
With the SmtpService, the Integration Server provides a complete SMTP server that, through its integration into the overall system, is able to inform all connected applications about incoming mails.
The SmtpService offers the following possibilities to offer mail-based data exchange.
Receive mails using the SMTP protocol.
Limitation of the delivering partners using authentication methods, e.g. PLAIN or LOGIN for ASMTP.
XML configuration
Important note: The availability of a service depends on the license purchased and whether the service has been registered in the configuration file ./etc/factory.xml of the Service Factory (changes require server restart!). There you will also find the responsible configuration file for a service, otherwise you can also edit the configuration file of the service directly in the GUI of the service (changes require a service restart!).
The following XML fragment with all possible base settings can be used to configure the SmtpService.
<
Set
name
=
"defaultMessageService"
>MessageService</
Set
>
<
Set
name
=
"listenAddress"
>0.0.0.0</
Set
>
<
Set
name
=
"maxAllowedMailSize"
>2048</
Set
>
<
Set
name
=
"numberOfThreads"
>5</
Set
>
<
Set
name
=
"usePersistantMessaging"
>true</
Set
>
<
Set
name
=
"port"
>25</
Set
>
The parameters have the following meaning.
defaultMessageService |
The name of the MessageService to forward incoming mails. |
listenAddress |
The IP address of the network interface to which incoming requests should be restricted. If all interfaces are to be supported, the parameter can be omitted or set to 0.0.0.0. |
maxAllowedMailSize |
The maximum size in bytes that an e-mail may have to be accepted by the SmtpService. The size must be specified in KB (1024 bytes). So if you want to accept up to 2 MB (the default) is accepted, the value 2048 should be specified. The value -1 specifies that there is no size limit. |
numberOfThreads |
The number of threads waiting in parallel for incoming requests. If all threads are busy with requests, further requests are not processed. Therefore, the number should be set high enough to avoid loss of speed. |
port |
The port to use for receiving incoming SMTP requests. |
usePersistantMessaging |
The mails are forwarded as persistent messages to the MessageService. |
Enabling SMTPS
To enable SMTPS, the following section must be inserted.
<
Set
name
=
"tlsPort"
>465</
Set
>
<
Set
name
=
"tlsSubjectName"
>*CN=*SMTP Server Certificate Example*</
Set
>
<
Set
name
=
"tlsRequired"
>true</
Set
>
Parameter tlsPort activates an additional port, on which the service is listening and direct TLS connections are established. For this to work, if acting as server, a certificate is needed, which must be set via the search string tlsSubjectName. If the certificate is set and found, the command STARTTLS is offered on the unencrypted port, which allows you to switch to TLS. With tlsRequired set to true, STARTTLS must be executed before any other operation can be performed, otherwise its use is optional.
Setting whitelist and blacklist entries
With this XML fragment a whitelist (allowed addresses) and blacklist (not allowed addresses) can be added.
"AddIpAddress" adds a single IP address, "addAddressRange" adds an address range.
<!-- define white access list here -->
<
Call
name
=
"getWhiteAccessList"
>
<
Call
name
=
"addIpAddress"
>
<
Arg
>a_single_IP_address</
Arg
>
</
Call
>
<
Call
name
=
"addAddressRange"
>
<
Arg
>base_IP_address</
Arg
>
<
Arg
>a_netmask</
Arg
>
</
Call
>
</
Call
>
<!-- define black access list here -->
<
Call
name
=
"getBlackAccessList"
>
<
Call
name
=
"addIpAddress"
>
<
Arg
>a_single_IP_address</
Arg
>
</
Call
>
<
Call
name
=
"addAddressRange"
>
<
Arg
>base_IP_address</
Arg
>
<
Arg
>a_netmask</
Arg
>
</
Call
>
</
Call
>
Restricting to specific senders and receivers
You can use the configuration file ./etc/mail_address.properties exists to specify email senders and email recipients (including CCs). Only if both the sender and the recipient of the received email are found in this file, the the email be processed. This is especially useful when you are using a DMZ server to exclude spam emails. The file is structured as follows.
# define access list for smtp service
# only accept mails if sender address or (cc) recipients of incoming mail
# are found within this list
# addresses are separated by ;
# example:
# mail.sender=info@lobster.de;lobster.de
# mail.recipients=dw@lobster.de;lobster.de
#
mail.sender=lobster.de;test.org
mail.recipients=hub.org;xxx.org
Adding an "SmtpAction"
The following XML fragment adds an SmtpAction to the SmtpService.
<
Call
name
=
"addAction"
>
<
Arg
>
<
New
class
=
"com.ebd.hub.services.smtp.SmtpAction"
>
<
Arg
>System</
Arg
>
<
Arg
>smtp</
Arg
>
<
Call
name
=
"add"
>
<
Arg
>allowedAddress@domain</
Arg
>
</
Call
>
</
New
>
</
Arg
>
</
Call
>
The two parameters correspond to the message context and the message queue to be used. For each email address that is to be activated for this queue, a corresponding call entry must be added to the configuration file.
Adding a user
The following XML fragment adds a user to the DirectSetAuthenticator.
<
Call
name
=
"addUser"
>
<
Arg
>
<
New
class
=
"com.ebd.hub.services.smtp.SmtpUser"
>
<
Arg
>username</
Arg
>
<
Arg
>password</
Arg
>
</
New
>
</
Arg
>
</
Call
>
Reading the user file
The following XML fragment makes the manager read the user file.
<
Call
name
=
"readUserFile"
>
<
Arg
>./etc/mail_users.cfg</
Arg
>
</
Call
>
The structure of a file for defining users is described in section Format of the FileAuthenticator User File.
General settings and available "SMTPActions"
(1) The MessageService to be used.
(2) The messages are forwarded as persistent messages to the MessageService.
(3) IP address and port of the SmtpService.
(4) Number of threads used to process incoming emails.
(5) Whitelist and blacklist can be edited here.
(6) The maximum size in bytes that an email may have to be accepted by the SmtpService. The size must be specified in kB (1024 bytes). So, if you want to accept a maximum of 2 MB (the default), specify 2048. The value -1 specifies that there is no limit to amount of data to be accepted.
(7) List of the available SMTPActions. These can be added, edited and removed via the context menu.
Editing "SMTPAction"
(8) Settings of the MessageService for the SMTPAction. You can either use the Default MessageService, or any other one. With the parameters Message Context and Message Queue, you can use the MessageService to control who should receive the messages.
(9) Email addresses can be added, changed and deleted here.