Skip to content

GlobalMailJob Guide

Intro

This guide will help you set up and run a Mailagent. I use Malik Supply as an example with images for illustration.
The guide is written based off a video guide by Kristian Vesterskov. Which you can watch here.

Placeholders

The document has the following placeholders:

  1. {customer_database_name} - Can be found in the SQL. This example uses mTIME_MALIK_PROD as the {customer_database_name}
  2. {customer_email} - This is given by a consultant, if it’s not already known. Contact a consultant.
  3. {mTIME_CUSTOMER_PROD_API port} - Check Image 3 for where to find the API port.

Remember to replace these! Or else none of it will work!

Step 1: .CMD/.cfg configuration

Mailagent configuration is done on the same server number as the C-PROD-SQL number.
So for this example with Malik Supply, are installed on C-PROD-SQL03, therefore mailagent configuration is setup in C-PROD-APP03.

  1. Remote to the needed C-PROD-APP server
  2. Open D:\Jobs in file explorer
  3. Create a new file, with the name mTIME_{customer_database_name}_PROD.CMD - Replace
  4. Edit the new file and insert the follow text - Replace the {} and it’s contents with the actual customer database name.
cd “D:\JOBS\WebServiceAktivator” echo fravaersagent for {customer_database_name} .\bin\WebServiceAktivator.exe -f .\bin{customer_database_name}.cfg mTIME_{customer_database_name}_PROD_MAILAGENT 999000000
  1. Open D:\Jobs\WebServiceAktivator\bin in file explorer
  2. Create a new file, with the name {customer_database_name}.cfg - Replace the {} and it’s contents with the actual customer database name.
  3. Edit the new file and insert the follow text - Replace the {} with the required text. See Image 3 for API port example.
[mTIME_{customer_database_name}_PROD_MAILAGENT] http://localhost:{mTIME_CUSTOMER_PROD_API port}/mtid/mtid_webservice.asmx?wsdl mTID_WebService.MailAgent_Run()

Step 1 Cmd Cfg Configuration
Step 1 Cmd Cfg Configuration
Step 1 Cmd Cfg Configuration 2
Step 1 Cmd Cfg Configuration 2
Step 1 Cmd Cfg Configuration 3
Step 1 Cmd Cfg Configuration 3

cd “D:\JOBS\WebServiceAktivator” echo fravaersagent for MALIK .\bin\WebServiceAktivator.exe -f .\bin\MALIK.cfg mTIME_MALIK_PROD_MAILAGENT 999000000
Image 4, mTIME_MALIK_PROD - Mailagent.CMD
[mTIME_MALIK_PROD_MAILAGENT] http://localhost:23910/mtid/mtid_webservice.asmx?wsdl mTID_WebService.MailAgent_Run()
Image 5, MALIK.cfg configuration example

Step 2: Check SQL

Before starting on step 2. Make sure the customer has the Start Gml Mailagent job, if they don’t. Add it, and come back.

  1. Create a new query on the customer DB
SELECT * FROM VersionsMuligheder WHERE Navn IN (‘GlobalMail_DefaultSender’, ‘GlobalMail_Host’, ‘JobNameMailAgent’, ‘Kvitteringsadresser’)

Check the following values:

ColumnsValue
GlobalMail_DefaultSendernoreply@timemsystem.com
GlobalMail_Hostin-v3.mailjet.com
JobNameMailAgentmTIME_{customer_database_name}_PROD - Start Gml Mailagent
KvitteringsadresserThis value should be the email given by the customer. If it hasn’t be changed yet, and the value remains “KONSULENT/kunden SÆTTER OP”. Run the command: Update VersionsMuligheder set Vaerdi = ‘{customer_email}’ where navn = ‘Kvitteringsadresser’

Step 2: Task Scheduler

  1. Open task scheduler and create a task

    1. General:

      1. Change name to “mTIME_{customer_database_name}_PROD - Mailagent”

      2. Change user to TIMEMSYSTEM\SVC

      3. Change to “Run whether user is logged on or not”

        Step 2 Task Scheduler
        Step 2 Task Scheduler
    2. Triggers:

      1. Set task to run ‘Daily’, and set the time to be off-hours.

        Step 2 Task Scheduler 2
        Step 2 Task Scheduler 2
    3. Actions:

      1. Set action to start the .CMD

        Step 2 Task Scheduler 3
        Step 2 Task Scheduler 3
  2. Run the job

  3. Check logs under D:\Jobs\WebServiceAktivator\logs

Step 3: TMSService

  1. Open D:\Jobs\TMSService\bin\TMSServiceWPF.exe

  2. Click ‘Add Installation’, and fill in the customer name in Job Name

    Step 3 Tmsservice
    Step 3 Tmsservice
  3. This is the configuration of TMSService for GlobalMail. Change the following values:

    1. Unique Name : {customer_database_name} - GlobalMail
    2. Installation Name : Choose MALIK
    3. Type : GlobalMailJob
    4. Repeat : Interval
    5. Interval : 10
    6. Status Mail When : None
    7. Installation Name : {customer_database_name}
    8. mTIME-ConnectionsString : This can be either copied over from another another installation, if done so. Do remember to change the neccessary values such as naming and password. Or go to D:\Websites\mTIME_{customer_database_name}_PROD_API\Web_Local_ConnectionString.config and copy the connection string.
Step 3 Tmsservice 2
Step 3 Tmsservice 2

Step 3.1: Testing TMSService

After setting up TMSService GlobalMailJob, you can make sure it works by following these steps:

  1. Change interval to 1 in TMSService.

  2. On the customer DB, run this command SELECT * FROM GlobalMail

  3. Check ProcessedTime. If it’s NULL, TMSService isn’t setup correctly. It should be giving a datetime.

    Step 3 1 Testing Tmsservice
    Step 3 1 Testing Tmsservice

Remember to change Interval to 10 afterwards.


Source: Confluence | Page ID: 594051074