How to start sending SMS
Be aware the SMS coverage is currently available in North America only. The API can only send and receive SMS to/from the US and Canada.
SMS in Europe is coming soon, send us an email to be added to the Europe invite!
Before you can start sending SMS with MailerSend, you first need a toll-free phone number. So you can test out the SMS feature without committing to a subscription, a trial phone number is provided for all premium accounts.
When you're ready to send more, purchase a phone number from the Billing > Add-on page, follow these instructions.
Manage your phone number
You can then purchase a toll-free phone number from the Add-ons page to use to send e-commerce SMS notifications to your customers. After doing so, remember to submit the Verification form. Otherwise, you will not be able to deliver SMS.
You can view and manage your phone numbers on the Phone numbers page beneath SMS on the left-hand navigation menu. If you don't yet have a phone number, purchase one from the Billing > Add-on page, follow these instructions.
Create an SMS API token
To start sending SMS, you’ll need to use an API token. Ensure that if it’s a custom token, it has the SMS permission toggled to Full access, so you have reading and writing access. You can also use an existing API token with full access. Existing tokens are retro-compatible with the SMS feature.
For more information on how to create and manage API tokens, visit our API token management guide.
Send an SMS
With your language of choice or from your testing terminal, you can send a POST request to https://api.mailersend.com/v1/sms with the following request:
{
"from": "+18332647501",
"to": [
" +16203221059"
],
"text": "This is just a friendly hello from your friends at MailerSend."
}
Check your SMS status
After sending an SMS, you can check the status of the message in the Activity tab.
You can also see its status by querying the /sms-messages endpoint with the /{sms_message_id} from the header of the /sms endpoint’s response.
Get your SMS status by sending this GET request to the endpoint:
https://api.mailersend.com/v1/sms-messages/{sms_message_id}.
Available statuses are: processed, queued, sent, delivered and failed.
{
"data":{
"id":"62a75e82d8685cb6d2048fc2",
"from":"+18332647501",
"to":[
"+18332552485"
],
"text":"🍿 Hey this is just a friendly hello",
"paused":false,
"created_at":"2022-06-13T15:57:54.347000Z",
"sms":[
{
"id":"62a75e83ba260242650412e2",
"from":"+18332647501",
"to":"+18332552485",
"text":"🍿 Hey this is just a friendly hello",
"status":"failed",
"segment_count":null,
"error_type":"opt_out",
"error_description":"Recipient opt-out",
"created_at":"2022-06-13T15:57:55.469000Z"
}
],
"sms_activity":[
{
"from":"+18332647501",
"to":"+18332552485",
"created_at":"2022-06-13T15:57:55.503000Z",
"status":"failed",
"sms_message_id":"62a75e82d8685cb6d2048fc2"
},
{
"from":"+18332647501",
"to":"+18332552485",
"created_at":"2022-06-13T15:57:55.493000Z",
"status":"processed",
"sms_message_id":"62a75e82d8685cb6d2048fc2"
}
]
}
}
Provide unsubscribe instructions
For all marketing or promotional messages, you must include instructions on how to opt out, such as “Reply STOP to unsubscribe.” Failure to do so will result in us stopping your ability to send SMS, in accordance with our terms of use.
Commands
The STOP command
Recipients can opt-out of receiving SMS messages at any time by sending “STOP”, “Stop”, or “stop” in the text. The message doesn’t have to be comprised solely of one word, it just has to be within the text. Their phone number will be added to the “Unsubscribed” suppression list. Find all suppressed recipients on this page.
The START command
If a phone number is in the opt-out suppression list, they can opt back in by sending “UNSTOP", “unstop”, "START" or “start” commands in the text.
About SMS encoding and segmentation
SMS messages have character limits. If a message has more characters than the allowed limit, it is segmented into multiple parts and assembled back by the receiving device, thanks to the User Data Header (UDH).
The limits are:
160 characters/segment if the encoding is GSM-7
70 characters/segment if the encoding is UCS-2 (e.g. when using languages such as Arabic, Chinese, Korean, Japanese, or Cyrillic alphabet languages or emojis)
You will be billed by segment and not by message.
What is a User Data Header?
The User Data Header (UDH) takes up 6 bytes and instructs the receiving device how to reassemble the segments so that your whole message will be shown as one SMS message on the receiving handset. The maximum number of characters per concatenated (long) message is slightly reduced due to the inclusion of concatenation headers (UDH).
Encoding an SMS
The encoding used depends on the content of the message. MailerSend takes care of the encoding part for you, so whatever text editor you’re using, you don’t have to worry about it. For example, the same 355 character message has 3 segments in GSM-7 and 6 in UCS-2.
GSM-7 is a character encoding standard used for commonly used letters and symbols in many languages
It uses 7 bits to send a single character/symbol on GSM networks. As SMS messages are transmitted as 140 8-bit octets at a time, GSM-7 encoded SMS messages can carry up to 160 characters (140*8/7=160)
You can view the basic character set for GSM-7 here
UCS-2 is a character encoding standard used if a message cannot be encoded using GSM-7 or when a language requires more than 128 characters to be rendered
It uses a fixed-length 16 bits (2 bytes) to send a single character. As SMS messages are transmitted as 140 8-bit octets at a time, UCS-2 encoded messages can carry upto 70 characters {(1408) / (28) = 70}
UCS-2 can encode anything in the Basic Multilingual Plane
Splitting an SMS
SMS messages are split when they reach the character limit, which depends on the encoding. You can check out this tool to see what encoding your message is using and how it will be segmented.
Need more info?
Feel free to talk with us via live chat or contact us at support@mailersend.com.
- Getting started
- FAQ
-
Features
- Sending domains
- Managing API tokens
- Domain tracking options
- How to add a domain space to your account
- SMTP relay
- Webhooks
- Inbound routing
- Templates
- How to add a survey to your emails
- Email tagging
- File manager
- Email and recipient activity
- Analytics
- Split Testing
- How to use the MailerSend iOS app
- Schedule bulk emails with the bulk endpoint
- Ensuring secure SMS communication: Verification and usage limits
- SMS: How to handle opt-in and opt-out
- Custom headers
- Upcoming changes to TLS Protocol support
- How to request a dedicated IP
- Deliverability
- Account settings
- Billing
- Integrations
- How to use personalization in emails