LINK Mobility DK Smtp Api v2
This document describes how to use SMTP to send messages though the REST backend
API
The new system works in 2 ways
- Set options in TO field, this makes it possible to set simple options if you have systems where you can't change the subject field
- Set options in SUBJECT field, this is more flexible, but require you to change the subject of the email
Email struktur
SMTP field | Format | Description |
---|---|---|
TO | [option][option][apikey]+[type][recipients]@smtp.linkmobility.dk | Only boolean options are available in TO |
FROM | default | |
SUBJECT | default | If field is left alone only TO options are used |
SUBJECT | { 'option1': 'value', 'option2': 'value' } | json format with the options |
BODY | default | the message to send as a SMS |
Options
Some options can only be defined in SUBJECT
Name | Where | Required | Default | Value | Description |
---|---|---|---|---|---|
apikey | TO or SUBJECT | yes | Authentication api key | ||
type | TO | yes | sms, list | sms = a single phone number, list = list id | |
recipients | TO or SUBJECT | yes | set in TO for 1 recipient, if more recipients are needed you need to use SUBJECT | ||
status | TO or SUBJECT | no | false | 1/true, 0/false | Should a delivery reports be mailed back to FROM |
use_sender | TO or SUBJECT | no | false | 1/true, 0/false | Should the name defined in FROM be used as sms sender |
sender | SUBJECT | no | Set sms sender. For instance "+4512345678" or "MYNAME" |
Eksempler
Simple
Simple SMS with no changes in subject, recipient is set in TO and all options are default
To : e1bd9f58b7d6a45b48fa92c427932c4ad3744afd23a8b99af207de991f78f9d4+sms4512345678@smtp.linkmobility.dk From : Henrik Nicolaisen <support@linkmobility.dk> Subject : Zabbix: error in something Body : selve teksten
Simple SMS with no changes in subject, recipient is set in TO and some options are set
To : use_sender+status+e1bd9f58b7d6a45b48fa92c427932c4ad3744afd23a8b99af207de991f78f9d4+sms4512345678@smtp.linkmobility.dk From : ZABBIX <support@linkmobility.dk> Subject : Zabbix: error in something Body : selve teksten
Simple SMS with multiple receivers in the subject and with a custom sender ZABBIX
To : e1bd9f58b7d6a45b48fa92c427932c4ad3744afd23a8b99af207de991f78f9d4+sms@smtp.linkmobility.dk From : ZABBIX <support@linkmobility.dk> Subject: { "status": 0, "sender": "ZABBIX", "recipients": [ "+4512345678,+4512345679" ] } Body : selve teksten
Simple SMS with apikey in the subject and with a custom sender ZABBIX
To : sms4512345678@smtp.linkmobility.dk From : ZABBIX <support@linkmobility.dk> Subject: { "status": 0, "sender": "ZABBIX", "apikey": "e1bd9f58b7d6a45b48fa92c427932c4ad3744afd23a8b99af207de991f78f9d4" } Body : selve teksten
Advanced
Advanced example where options are defined in SUBJECT. Sending to a list id with the sms sender ZABBIX
To : e1bd9f58b7d6a45b48fa92c427932c4ad3744afd23a8b99af207de991f78f9d4+list1@smtp.linkmobility.dk From : Henrik Nicolaisen <support@linkmobility.dk> Subject : { "status": 1, "sender": "+4512345678" } Body : selve teksten
An advanced example sending to more recipients
To : e1bd9f58b7d6a45b48fa92c427932c4ad3744afd23a8b99af207de991f78f9d4+list@smtp.linkmobility.dk From : Henrik Nicolaisen <support@linkmobility.dk> Subject : { "status": 1, "sender": "ZABBIX", "recipients": [ 1, 3 ] } Body : selve teksten
Transforms and validation
For customers that can't change the structure of the email it is possible to create custom transforms.
This is only an internal LINK Mobility feature so if needed the rules should be applied by support.
rules_transform
Rule | Description |
---|---|
SET | Search for regex and set static value |
REPLACE | Search for regex and replace content |
MATCH | Search for regex and set other field to match |
CHARSET | Search for regex and change wrong charset to UTF8 |
rules_validate
Rule | Description |
---|---|
SPAM | Search for regex and exit with a spam error |
ALLOW | Search for regex and allow mail if true |
DENY | Search for regex add deny mail if true |
Feeling lost? Click on this link! Portal page