Sending first Emails

Getting Started with domail: Sending first Emails

In the previous article on our blog, titled "GETTING STARTED WITH domail - A Step-by-Step Guide," we demonstrated how to initialize and configure domail. In this article, we'll show you how to send your first emails through domail. Domail can be used in three ways. First, it can be used as an SMTP relay, allowing the transmission of existing emails generated in other applications Second, it is possible to integrate Domail with existing applications that send emails using REST and SOAP APIs. Third, Domail can create its own email campaigns.

  • 1. Configuring SMTP settings


    The first step is to log in to the domail user interface. Once logged in, navigate to the administration menu and settings section. Here, switch to the SMTP tab, where you'll see various parameters allowing SMTP server configuration. We have the option to set up 3 communication protocols: whether we want without encryption, we use port 25 and the PLAIN SMTP receiver settings. If we want a connection with implicit TLS, we use the IMPLICIT TLS SMTP receiver settings, and if we want explicit TLS, we use the EXPLICIT TLS SMTP receiver settings. Upon initial domail startup, port 25 is set up, which is enabled, and without authentication. This means we could now send a test email to this port. However, to secure domail with an SMTP server with TLS, we need to set up IMPLICIT TLS or EXPLICIT TLS SMTP receiver settings. These are disabled by default. Now, let's see how to set them up. Let's assume we want to use EXPLICIT TLS. The first thing we'll do is to set it to "ENABLED" state. Set up authentication and enter username and password for access. We can leave the port as it is, by default 587. We'll be alerted that these changes won't take effect immediately but require restarting the SMTP server.

  • SMTP config
  • 2. Managing Certificates


    Before restarting the SMTP server, we need to navigate to the certificates section. Click on the SMTP tab and proceed to upload a certificate, as SSL connection requires a certificate on the server side. The certificate should be uploaded in PEM format, specifically in unencrypted PKCS7 format. It must contains both the private key and certificate within a single file. After uploading the certificate, we're prompted to enter an alias. We can choose any alias we prefer.

    Managing certificates

    Next, a window will appear allowing us to select the certificate from our computer. Once selected, the certificate will be uploaded and appear on the card in the list as a newly added certificate. Now, we can proceed to monitoring. Stop the Input SMTP Service, then start it again to complete the process.

  • Restart SMTP - monitoring
  • 3. Sending first email


    The service is now running, and we can proceed to test our new settings. For example, in the Thunderbird application, we set up the SMTP server with the IP address, port 587, normal password, and the username "domail." We can then attempt to send a message. After entering the password, the email will be sent. Subsequently, we can check in domail to see if the email has arrived. In the communication section, we can verify if a new communication has been added. We'll be able to see the recipient's address and which scenario was used. By delving into communication detail, we can access additional data, such as the script used for processing the communication. Furthermore, we can also review the email content. Now we have successfully sent our first email through domail, using it as an SMTP relay.

  • Sending first email
  • 4. Managing Scenarios


    If we want a more complex configuration, such as performing additional actions with the email when it reaches domail, we can create a new scenario. A group and category can be assigned to the new scenario, which is useful for statistical purposes. This allows emails passing through a given scenario to be categorized and displayed in statistics and various views. For example, we can set a group called "Marketing" and a category called "Newsletter." The script in this case can be set to default. After saving the SMTP scenario, we also need to set conditions for when it should be used. The default value is "false", meaning the scenario will never be used. We can select various preset values from the top menu. For instance, we can choose "Recipient", which means the scenario will be used if the email is sent to a specific domain.

  • SMTP - scenario, category, group
  • If we want to modify the email or perform other actions, we need to create a new script. In this script, we define what should be done, such as setting specific values so the email can be sent. For example, we can change the subject line and then save the script. Next, we can run a test of the script to ensure everything works correctly. Once validated, we need to assign script to scenario. We then send the email, check the communications log, and confirm that a new communication was added. We see that it was sent, and it has the designated scenario, group, and category. When we look at the preview, we can compare how it originally looked with how it appeared when it was received, noting that it came with the updated subject.

  • SMTP - script

This is how we demonstrated the basic setup of SMTP and the use of domail as an SMTP relay. At the same time, we also demonstrated the basic setup of the scenario and script for sending emails.

To report a bug, please use this form. Please provide the URL of the page where you experienced the bug if possible.