Testing e-mail functionality can be problematic in some situations. You may not have access to an SMTP server needed to send e-mails from Sage X3 and to receive. The last thing you want to do is to inadvertently e-mail your contacts or get your domain blacklisted for sending out spam e-mails.
In this blog post, I will give you an insight into how we test the e-mail functionality available in Sage X3 in the support team. I will cover
- What is an SMTP server, and how it works with Sage X3
- How to install & configure Hmail SMTP server for local delivery of e-mails
- Configuring your mail client to connect to the Hmail Server to send and receive e-mails locally
- And finally, sending e-mails from Sage X3 so you can see the result locally on your client
Note: I will refer to Hmailserver, a free, open-source e-mail server for Microsoft Windows, and Mozilla Thunderbird, a free and open-source e-mail client in this blog. Sage has no affiliation with these products, and alternatives are available.
1. What is an SMTP Server
SMTP Stands for Simple Mail Transfer Protocol. The server is an application that can be installed locally or in the cloud. The application's main purpose is to receive e-mails and send these to e-mail recipients and to relay.
SMTP servers understand simple text commands. Some of the common commands are:
HELO To establish a connection
MAIL FROM Specify the sender
RCPT TO Specify the recipient
DATA Specify the body of the e-mail
In the context of Sage X3, an e-mail will be generated and relayed to the SMTP server, which will then be passed to the e-mail service provider, which will then deliver to the destination. Sage X3 uses an application called meladx.exe located in the runtime\bin directory to relay generated e-mail messages. Your SMTP server needs to be defined in the SERMES parameter in the ADPVAL function; we will look at it later.
2. How to install & configure the Hmail SMTP/POP3 server for local delivery of e-mails
You can install the mail server component on any machine as long as you can access the SMTP & POP3 ports. In this example, all components are installed on a single machine, including Sage X3 components.
Hmailserver is available from https://www.hmailserver.com. At the time of writing this blog, the latest available version is 5.6.7. once you have downloaded the install files, progress to install the application
Specify the install path the select to install the server component and the administrative tools
There are two options when installing you can either use an inbuilt database engine or if you prefer, you can configure the server to use your own SQL server instance.
Specify a password that you will use to access the email servers administrative functions.
Once the installation is complete, we can proceed to configure our mail server for the local delivery of e-mails. Launch the Hmail administrator hMailAdmin.exe and log in.
Next, create a domain that you will use for testing. I used sagex3.com.
This is a dummy domain for testing and can be any value Iana (https://www.iana.org/domains/reserved) the internet assigned numbers authority suggest using example.com.
Add a catch-all address (Domain -> Sagex3.com -> Advanced -> Catch-all address) , e.g. [email protected]. If an e-mail is sent to this domain, but the address of the e-mail does not match any existing account under this domain, the catch-all address will receive this e-mail.
Next Under Settings -> Protocols -> SMTP -> Delivery of e-mail, specify the hostname to be localhost.
Under Advanced -> IP Ranges, delete Internet. This step is a safety measure to ensure that the e-mail server will only be used locally.
The last step is to set up your e-mail account, in my case [email protected], and that's the mail server installed and configured.
3. Configuring your mail client to connect to the Hmail Server to send and receive e-mails locally.
Now we are ready to connect an e-mail client and test that your SMTP Server is working. In this example, I used Mozilla Thunderbird, which is a freeware client.
The mail client can be installed on any machine as long as the appropriate ports are open for connecting to the mail server (SMTP & POP3 ports). In this example, Thunderbird is installed on the same machine as the mail server.
Once installed, launch Mozilla Thunderbird and add a new mail account
Select manual configuration.
Because we are using the Hmail server for testing locally only, we have not set up any advanced security, accept this message and continue.
We can now send a message to the account we created ([email protected]) to ensure that e-mail sending and delivery are working.
4. Sending e-mails from Sage X3 so you can see the result locally on your client.
Now we can start to test the e-mail functionality from Sage X3, hopefully seeing our e-mails delivered locally to our e-mail client.
You can test your mail server by setting up a notification server (Administration, Servers, Notification servers) and using the test configuration settings. This will send an e-mail message to the specified e-mail address.
To test workflow messages, you must specify the E-mail server value in the SERMES parameter for the e-mail server.
- Go to the menu Parameter, General parameters, Parameter values (ADPVAL function).
- In the Chapter field, enter or select SUP, and then press the Tab key.
- In the table, for the WRK group, select Detail from the Actions icon at the beginning of the line.
- In the Parameter values screen, change the hostname value for AWRKSYRA, SERMES, WRKSINTER and WRKSINTRA parameters.
- Click Save.
The screenshot below shows my configuration. 127.0.0.1 is the localhost/Loopback address because all components are on the same machine. If your mail server is on another machine, you can specify the address for that machine.
Note: There are no authentication settings for connection to the e-mail server, so you have to set up security appropriately on the mail server side to relay from Sage X3.
You will also need to set your user e-mail address for workflow. For example, set admin user workflow mail address to [email protected] as this the account we created in Hmail Server and configured in the e-mail client. This is set in Parameters, Users, Users (GESAUS Function)
Now we can set up a notification to make sure that any messages from X3 are being delivered locally to our email client.
You can set up a simple notification in the SEED folder
- Open Parameters, Workflow, Notifications (GESAWX).
- Click New to create a new notification. Called ZNTEST to populate the triggering, conditions addresses and message sections.
Populate the message section validate and save the notification setup
Now navigate to Common data, BPs, Customers & change the ABC class of a customer record and save
The generated e-mail notification from the workflow notification will be delivered to the inbox
I hope you found this blog post a helpful insight into how you could set up a mail server to send and deliver e-mails locally from Sage X3 for any testing purposes.
Useful links
Hmail server website https://www.hmailserver.com/
The SMTP Protocol https://en.wikipedia.org/wiki/Simple_Mail_Transfer_Protocol
Mozilla Thunderbird https://www.thunderbird.net/en-GB/
E-mail server parameters https://online-help.sageerpx3.com/erp/12/staticpost/e-mail-server