ws-smtp-api v1.3.8
ws-smtp-api
WinSMS SMTP API
Deployment Guide
Overview
The Docker image can be deployed as a container to any host offering Docker hosting, or a simple Ubuntu install with Docker. I cannot detail a deployment guide for every possible Docker hosting environment, but will provide the neccessary details on ENVIRONMENT VARIABLES, VOLUMES, and PORTS.
Environment Variables
Application Specific
NAME | TYPE | DEFAULT | DESCRIPTION |
---|---|---|---|
REQUIRED_ROLES | STRING | ApiServiceSmtp | A comma separated list of roles that all users must satisfy in order to use the API. Should be set to blank for SA instance, to ensure that users do not need the SMTP API flag enabled. |
ENABLE_SUBJECT_AUTH | BOOLEAN | false | Instructs the WS-SMTP-API to use subject-line provided user credentials - BUT ONLY as a fallback, if email address authentication fails. Should be set to true for SA instance. |
VALID_DOMAINS | STRING | mail2sms.io,email2sms.io | A comma-separated list of domains that the WS-SMTP-API will process. Any incoming emails not addressed to any of the listed domains will NOT be processed. For the SA server, simply replace mail2sms.io,email2sms.io with e-mail2sms.co.za |
Database Specific
NAME | TYPE | DEFAULT | DESCRIPTION |
---|---|---|---|
MSSQL_SERVER_IP | STRING | 20.77.42.40 | The IP Address of the MS SQL Server |
MSSQL_DATABASE | STRING | SmsServer | The NAME of the database on the MS SQL Server |
MSSQL_USER | STRING | IwNodeTestJan2021 | The Login Name of a user that has access to public SPs on the database. |
MSSQL_PASSWORD | STRING | **** | The Password for the above user |
MSSQL_TIME_OFFSET | INT | 0 | The offset, in hours, that the server is from GMT. This will be 0 for the international server, as it uses GMT, but 2 for the SA server, as it is 2 hours ahead of GMT. |
MSSQL_NORMALISE_MOBILE_NUMBERS | BOOLEAN | false | Not currently used. Currently handled by the SPs on the different servers On the SA DB: Recipient mobile numbers have a default dial code of 27 appended if none is present. On the International DB: SA dial codes are NOT appended if not present - causing them to fail if not in proper international format. |
PaperTrail Logs Specific
NAME | TYPE | DEFAULT | DESCRIPTION |
---|---|---|---|
PAPERTRAIL_HOST | STRING | logs.papertrailapp.com | The host name of the PaperTrail account that these logs will be sent to. Can be retrieved from the PaperTrail account dashboard. |
PAPERTRAIL_PORT | INT | 37666 | The PORT of the PaperTrail account that the logs will be sent to. Can be retrieved from the PaperTrail account dashboard. |
PAPERTRAIL_PROGRAM | STRING | WS-SMTP-API | A name, that will be displayed in the logs, of the application that generated the logs. This can be any valid text, and is for reference purposes only. Having an application name attached to the log entry makes searching much easier. |
PAPERTRAIL_HOSTNAME | STRING | DOCKER-LON1 | A name, that will be displayed in the logs, of the host (Server) that generated the logs. This can be any valid text, and is for reference purposes only. Having a host name attached to the log entry makes searching much easier. |
PAPERTRAIL_MIN_LEVEL | STRING | debug | The minimum level of events to log. debug = lots of information in the log - useful for finding niggly errors - bloats your log, which ultimately costs money. info = ONLY important, warn and error information in the log - keeps logs concise, small, and cheaper. warn = ONLY warn and error information in the log error = ONLY error information in the log - smallest |
Testing Documentation
Client Requirements
Email Client - This can be anything from a text based email client to MS Outlook to Gmail
OR
Automated internal or SaaS system capable of sending emails to a specified email address FROM a CONSISTENT email address.
Working internet connection
WinSMS Account Requirements
Ensure you have a username and password for your WinSMS Accounts on WINSMS4 and WSMSINT1. I currently cannot see WinSMS User Accounts for Jaun, Evan and Dawie on WSMSINT1 - You can try creating these accounts yourself using the AZ on winsms.io, or ask Jeremy to copy your User Accounts across from WINSMS4.
Ensure that your test email address/es are added for Sender E-mail Address Authentication in the CZ on both winsms.co.za and winsms.io.
Ensure that you enable the SMTP API for the test Accounts in the AZ on both winsms.co.za and winsms.io - see image:
Method of Testing
**Note:**
The domains @mail2sms.io and @email2sms.io both point to the same WS-SMTP-API connected to WSMSINT1 (International Server).
So both domains use the exactly the same processing logic.
Once you've tested emails to both domains a single time, you can pick one and stick with it.
**Note**
Ensure you've set up your International Accounts before starting to test.
**Note***
The DB on WSMSINT1 DOES NOT automatically normalise SA numbers to add their international dial code if not supplied.
eg.
0826520938@mail2sms.io WILL NOT WORK
27826520938@mail2sms.io WILL WORK
ALWAYS ADD A DIAL CODE to numbers before sending, when dealing with winsms.io
Standard - Unscheduled
- Send an email to yournumber@mail2sms.io and yournumber@email2sms.io with
- Nothing in the subject line
- A simple email body of 160 characters or less
Ensure you receive an SMS containing the body of the email you sent to yournumber.
Ensure that the SMS you sent reflects in the CZ on winsms.io, under Sent Message Log. Don't worry about the timestamps on winsms.io, the international CZ needs a code upgrade.
Testing multiple recipeints
Send an email to multiple addresses at once, using @mail2sms.io, @email2sms.io, and external addresses eg. 27826520938@google.com and iwatson@inkey.tech.
Verify in your log that only valid numbers (international format) at the two valid domains were accepted.
Testing Authorization Methods
Delete your email address from the list of Sender E-mail Address Authentication addresses in the CZ on the E-mail to SMS tab of My Profile (winsms.io).
Attempt to send the same email you did in the Standard test, to the same number.
Expect this to fail, as you didn't provide a username and password in the subject line.
Send another email, the same as before, but add #username,password# to the subject line of the email.
Expect the SMS to be delivered to you, and verify in your logs on winsms.io.
Testing Long Message Support
Add your mobile number back to the list of Sender E-mail Address Authentication addresses. This is just to make testing easier and faster.
Ensure Enable Long Messages is DISABLED in the CZ on the E-mail to SMS tab of My Profile (winsms.io).
Send a long message to your test number using email. I use: 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890ABCDEFGHIJKLMN
Ensure that you receive an SMS containing only the first 160 characters of the email body.
Verify the message in your Sent Logs on winsms.io
Ensure Enable Long Messages is ENABLED in the CZ on the E-mail to SMS tab of My Profile (winsms.io).
Send the same long message from above to your mobile number.
Ensure that your SMS contains the first 918 characters of your email body. If you use my test string, your message should cut off at the letter H.
Verify message in your logs
Testing Scheduled Messages - Subject Authentication
Remove your email address from the list of Sender E-mail Address Authentication addresses in the CZ on winsms.io.
Send an email to your number with the following subject line: #username,password,202112251200#
Ensure the message appears in your Scheduled Message Log in the CZ on winsms.io, with a Scheduled For date of: 2021-12-25 10:00. You'll notice the time is displayed in GMT time in the Scheduled Log on winsms.io - hence 10 AM instead of 12PM (SA time). If you wait patiently, your SMS will be delivered at noon on Christmas day this year, please verify :)
Testing Scheduled Messages - Sender Authentication
Add your email address back to the list of Sender E-mail Address Authentication addresses in the CZ on winsms.io.
Send an email to your number with the following subject line: 202112251200
Ensure the message appears in your Scheduled Message Log in the CZ on winsms.io, with a Scheduled For date of: 2021-12-25 10:00.
Sundry Testing
Try and break the API - send attachments, HTML emails with inline images, blank messages, extra long messages etc.
If you break the API, you win a prize! )
3 years ago