Setting a SMTP client for iTgateway

A very powerful function of !tGateway is the ability to send text files to an external Simple Mail Transfer Protocol (SMTP) server.

The SMTP client gateway connector can be configured to send files as attachments and/or as the body of the email.   This ability is very useful if you are trying to send items like PDFs, Spreadsheet or CSV files.   It can also be leveraged to have custom text files sent as plain text or as HTML (Hypertext Markup Language) which is useful for customer type communications.   Some of our customer use this latter ability to forward system error messages that require user action.   The options of the SMTP client are quite flexible.   This article will demonstrate an overview and some simple examples.

Below will be examples of how the SMTP relay can be leveraged to fit many needs for a customer.

But first how does it work.

!tGateway can be configured to send files from a directory.  The source of the file can be anything.   The examples shown here are based on the !tSuite feature called tOutput.   This feature allows for the creation of text files into folders.   It in itself is very powerful. 

Overview

 

itgateway overriew of SMTP Relay

 

The graphic above demonstrates a data flow.   Here is an explanation of the flow

  • tOutput reads from business data and creates a text file and places the output in a folder
  • !tGateway then monitor the configured folders
    • Using the configuration it determines if the file is to be used for the body or as an attachment
    • It then applies the header information to find the TO, CC, BCC, SUBJECT and BODY of the email
    • It connects to the SMTP Server.
  • The file is then sent via the Internet and a copy is placed in the archive folder

!tGateway Main screen

itgateway configuration screen

Limitations

SMTP by definitions has limitations.   SMTP has been around since the early 1970s, yes that is correct.   As such the word SPAM was used for food and NOT junk mail back then.   So the SMTP method is called a blind pass.   The payload is sent to the relay host and then the relay host forwards it to recipient’s servers.   Many service providers today put many restrictions on sending mail.   It is in your best interest to research your service provider’s requirements so as to NOT flag your company as a source of spam.   If you require to send large volumes of emails in short periods of time, then I would recommend using a 3rd party relay as your relay provider.   The fees are minimal and they offer an excellent service.   !tGateway works well with those providers as well as traditional SMTP servers.

!tGateway converts the request into a valid SMTP payload and then forwards it to a SMTP server for furtherance. 

Example 1 (All files are to be sent as attachments)

This is an excellent approach to send regular reports to a standard list of users.  For example, a daily report of trailers in a yard.   The file is a CSV file that is created by tOutput but it could have easily been created by any system.  

  1. Click on the configuration (gear symbol) beside SMTP_CLIENT
  2. On the following screen you will be presented with many columns. Below is what each is looking for
    1. This_Item_name: A unique name to give this configuration row
    2. Active: Check yes to make active. The gateway scheduler will poll all active connectors
    3. Email Username: This is the username of the SMTP server you will be connecting to. GMAIL will allow you to use them as a relay but they have limits to how many an hour you can use.  There are other 3rd party services that can also be used to get around SPAM issues.
    4. Email Password: the password the SMTP server is looking for.
    5. SMTP Server: the name of the SMTP server you will be connecting to.
    6. Port: what is the port of the server you will be using?
    7. Use SSL?: check this if you will be using SSL (Secure Socket Layer) to connect to the SMTP server. Refer to the SMTP connection information provided by the Email provider.
    8. Use TLS?: check this if you will be using TLS (Transport Layer Security). Again this is based on the SMTP server you will using to connect to.
    9. Scheduling Frequency: you can choose minutes, hours, days, weeks, months
    10. Every n: based on the frequency how often will the scheduler be checking. So a number 5 with a frequency of minutes will check every 5 minutes.
    11. From: What email do you want to have attached to the header of the email. You can have a different "reply to" email then what was used to connect to the server.
    12. TO: This is the default TO address. In this example it will be needed for all files will be sent to what is in these next few columns.   Example two explained later will show you how the actual text file can override these defaults.
    13. CC: this is the default Carbon Copy email address.
    14. BCC: Blind Carbon Copy. The gateway supports a blind copy of emails.   This is useful when you are sending emails to many users and you want to hide the email list.
    15. SUBJECT: What is the default subject line you would like for all the emails being sent out?
    16. Email Body: This is the text you want in the body of the email. This would be a standard email body for all recipients and all files in the folder.
    17. Attachments in Body: In this example you will check this for you want the files in the folder to be considered an attachment. The information above will be used to build the header and body and the file in the folder will be used as an attachment.
    18. Output Folder: Where is the connector to look for files? This is where you place files.   All files found in that directory will be sent the users defined above with the default subject and body defined.
    19. Archive Folder: Where do you want a copy of what was sent to be placed after it has been sent to the SMTP server.
    20. Company: This column is for future use and is NOT used by this connector.
    21. Account: This column is for future use and is NOT used by this connector.
    22. Last_Run_Date: is the date the connector was last polled.

Example 2 (Text file controls who receives the eMail)

This is an excellent approach to send specific emails with unique information in the body.   This could be customer confirmation of an order, an email to a service provider regarding a system report or just a general email regarding an actionable item.   You can even send HTML in the body to have the email customer presentable.  To do this the extension of the file must be “.HTML or .HTM”

  1. Click on the configuration (gear symbol) beside SMTP_CLIENT
  2. On the following screen you will be presented with many columns. Below is what each is looking for
    1. This_Item_name: A unique name to give this configuration row
    2. Active: Check yes to make active. The gateway scheduler will poll all active connectors
    3. Email Username: This is the username of the SMTP server you will be connecting to. GMAIL will allow you to use them as a relay but they have limits to how many an hour you can use.  There are other 3rd party services that can also be used to get around SPAM issues.
    4. Email Password: the password the SMTP server is looking for.
    5. SMTP Server: the name of the SMTP server you will be connecting to.
    6. Port: what is the port of the server you will be using?
    7. Use SSL?: check this if you will be using SSL (Secure Socket Layer) to connect to the SMTP relay. Refer to the SMTP connection information provided by the mail provider.
    8. Use TLS?: check this if you will be using TLS (Transport Layer Security). Again this is based on the SMTP server you will using to connect to.
    9. Scheduling Frequency: you can choose minutes, hours, days, weeks, months
    10. Every n: based on the frequency how often will the scheduler be checking. So a number 5 with a frequency of minutes will check every 5 minutes.
    11. From: Who is “reply-to” for this email. This must be filled in.
    12. TO: Leave blank, the file will contain the correct recipients
    13. CC: Leave blank, the file will contain the correct recipients
    14. BCC: Leave blank, the file will contain the correct recipients
    15. SUBJECT:    Can be placed in the text file
    16. Email Body: will be created by the text file
    17. Attachments in Body: In this example you will NOT check this for you want the body of the email to be created by the contents of the attachment.
    18. Output Folder: Where is the connector to look for files? This is where you place files.   All files found in that directory will be sent the users defined above with the default subject and body defined.
    19. Archive Folder: Where do you want a copy of what was sent to be placed after it has been sent to the SMTP server.
    20. Company: This column is for future use and is NOT used by this connector.
    21. Account: This column is for future use and is NOT used by this connector.
    22. Last_Run_Date: is the date the connector was last polled.

Text file formatting

The top of the text file must be formatted as follows.   The xml tags can be empty but they must exist in order to be processed.  See below

<iT-SUITE-SMTP_CONFIG>
 <TO>This email address is being protected from spambots. You need JavaScript enabled to view it.</TO>
 <CC>This email address is being protected from spambots. You need JavaScript enabled to view it.</CC>
 <BCC>This email address is being protected from spambots. You need JavaScript enabled to view it.;This email address is being protected from spambots. You need JavaScript enabled to view it.</BCC>
 <SUBJECT>outlook relay test </SUBJECT>
</iT-SUITE-SMTP_CONFIG>

 The text above must be formatted exactly as shown.   The tags can be empty but must exist.   Here is example of empty tags.

<iT-SUITE-SMTP_CONFIG>
 <TO>This email address is being protected from spambots. You need JavaScript enabled to view it.</TO>
 <CC></CC>
 <BCC></BCC>
 <SUBJECT>outlook relay test </SUBJECT>
</iT-SUITE-SMTP_CONFIG>

Sample Text

 Here is a sample completed text file sent as plain text to the users.

<iT-SUITE-SMTP_CONFIG>
 <TO>This email address is being protected from spambots. You need JavaScript enabled to view it.</TO>
 <CC>This email address is being protected from spambots. You need JavaScript enabled to view it.</CC>
 <BCC>This email address is being protected from spambots. You need JavaScript enabled to view it.</BCC>
 <SUBJECT>outlook relay test </SUBJECT>
</iT-SUITE-SMTP_CONFIG>
This email is confirmation to proceed to the US border. This is your acknowledgement to proceed for an ACE move to the US Border.
 
TRIP: TRP0094913 
Pros cleared: 1 
Total Probills: 3 
DRIVER: KARINE GRENON-DUBEAU
TRUCK: 176
as of: 1/31/2017 4:10:58 PM
 
--==[ E N T R Y N U M B E R S ]==--
-----------------------------------
PROBILL: PRO0309387 PAPS: ENTRY NUMBER: 
-----------------------------------
PROBILL: PRO0309934 PAPS: 00309934 ENTRY NUMBER: 33606862469
-----------------------------------
PROBILL: PRO0310083 PAPS: ENTRY NUMBER: 
-----------------------------------
.../
 

Sample HTML

 Here is a sample of block that will use HTML tagging.   The extension of the file must be either .HTML or .HTM

<iT-SUITE-SMTP_CONFIG>
<TO>This email address is being protected from spambots. You need JavaScript enabled to view it.</TO>
<CC>This email address is being protected from spambots. You need JavaScript enabled to view it.</CC>
<BCC>This email address is being protected from spambots. You need JavaScript enabled to view it.</BCC>
<SUBJECT>outlook relay test </SUBJECT>
</iT-SUITE-SMTP_CONFIG>
<h1>Thank you for your purchase of !tSuite</h1>
<p> </p>
<h2>Your order number is</h2>
 
<p>Order:138853 </p>
<p>date: January 01, 2017 </p>
<p> </p>
<p>Your licence key will follow shortly</p>
 Keywords: SMTP Client, SMTP Mail Relay, !Tsuite, !Tgateway,