Simple SMS
Using Local mail's API, you can send outgoing SMS messages from your Localmail phone number to mobile phones around the globe.
post
https://api.localmail.io/
v1/communications/sms/send-messages
Send Simple SMS
Learn more about SMS parameters and their definitions at SMS parameters overview
This page contains an interactive tool which can check if encoding your message in GSM-7 is possible, or if UCS-2 is needed.

Code Samples

CURL
PHP
GO
NODE.JS
PYTHON
RUBY
JAVA
Swift
C#
1
curl --location --request POST 'https://api.localmail.io/v1/lookup/email' \
2
--header 'sid: {sid}' \
3
--header 'accesskey: {accesskey}' \
4
--header 'Content-Type: application/x-www-form-urlencoded' \
5
--data-urlencode '[email protected]'
Copied!
1
<?php
2
3
$sid = "enter your SID token";
4
$accesskey = "enter your Accesskey token";
5
$email = "[email protected]";
6
7
$curl = curl_init();
8
9
curl_setopt_array($curl, array(
10
CURLOPT_URL => 'https://api.localmail.io/v1/lookup/email',
11
CURLOPT_RETURNTRANSFER => true,
12
CURLOPT_ENCODING => '',
13
CURLOPT_MAXREDIRS => 10,
14
CURLOPT_TIMEOUT => 0,
15
CURLOPT_FOLLOWLOCATION => true,
16
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
17
CURLOPT_CUSTOMREQUEST => 'POST',
18
CURLOPT_POSTFIELDS => $email,
19
CURLOPT_HTTPHEADER => array(
20
'sid: $sid',
21
'accesskey: $accesskey',
22
'Content-Type: application/x-www-form-urlencoded'
23
),
24
));
25
26
$response = curl_exec($curl);
27
28
curl_close($curl);
29
echo $response;
30
31
Copied!
1
package main
2
3
import (
4
"fmt"
5
"strings"
6
"net/http"
7
"io/ioutil"
8
)
9
10
func main() {
11
12
url := "https://api.localmail.io/v1/lookup/email"
13
method := "POST"
14
15
payload := strings.NewReader("[email protected]")
16
17
client := &http.Client {
18
}
19
req, err := http.NewRequest(method, url, payload)
20
21
if err != nil {
22
fmt.Println(err)
23
return
24
}
25
req.Header.Add("sid", "{sid}")
26
req.Header.Add("accesskey", "{accesskey}")
27
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
28
29
res, err := client.Do(req)
30
if err != nil {
31
fmt.Println(err)
32
return
33
}
34
defer res.Body.Close()
35
36
body, err := ioutil.ReadAll(res.Body)
37
if err != nil {
38
fmt.Println(err)
39
return
40
}
41
fmt.Println(string(body))
42
}
Copied!
1
var request = require('request');
2
var options = {
3
'method': 'POST',
4
'url': 'https://api.localmail.io/v1/lookup/email',
5
'headers': {
6
'sid': '{sid}',
7
'accesskey': '{accesskey}',
8
'Content-Type': 'application/x-www-form-urlencoded'
9
},
10
form: {
11
'email': '[email protected]'
12
}
13
};
14
request(options, function (error, response) {
15
if (error) throw new Error(error);
16
console.log(response.body);
17
});
Copied!
1
import requests
2
3
url = "https://api.localmail.io/v1/lookup/email"
4
6
headers = {
7
'sid': '{sid}',
8
'accesskey': '{accesskey}',
9
'Content-Type': 'application/x-www-form-urlencoded'
10
}
11
12
response = requests.request("POST", url, headers=headers, data=payload)
13
14
print(response.text)
15
Copied!
1
require "uri"
2
require "net/http"
3
4
url = URI("https://api.localmail.io/v1/lookup/email")
5
6
https = Net::HTTP.new(url.host, url.port)
7
https.use_ssl = true
8
9
request = Net::HTTP::Post.new(url)
10
request["sid"] = "{sid}"
11
request["accesskey"] = "{accesskey}"
12
request["Content-Type"] = "application/x-www-form-urlencoded"
13
request.body = "[email protected]"
14
15
response = https.request(request)
16
puts response.read_body
17
Copied!
1
OkHttpClient client = new OkHttpClient().newBuilder()
2
.build();
3
MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
4
RequestBody body = RequestBody.create(mediaType, "[email protected]");
5
Request request = new Request.Builder()
6
.url("https://api.localmail.io/v1/lookup/email")
7
.method("POST", body)
8
.addHeader("sid", "{sid}")
9
.addHeader("accesskey", "{accesskey}")
10
.addHeader("Content-Type", "application/x-www-form-urlencoded")
11
.build();
12
Response response = client.newCall(request).execute();
Copied!
1
import Foundation
2
#if canImport(FoundationNetworking)
3
import FoundationNetworking
4
#endif
5
6
var semaphore = DispatchSemaphore (value: 0)
7
8
let parameters = "[email protected]"
9
let postData = parameters.data(using: .utf8)
10
11
var request = URLRequest(url: URL(string: "https://api.localmail.io/v1/lookup/email")!,timeoutInterval: Double.infinity)
12
request.addValue("{sid}", forHTTPHeaderField: "sid")
13
request.addValue("{accesskey}", forHTTPHeaderField: "accesskey")
14
request.addValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type")
15
16
request.httpMethod = "POST"
17
request.httpBody = postData
18
19
let task = URLSession.shared.dataTask(with: request) { data, response, error in
20
guard let data = data else {
21
print(String(describing: error))
22
semaphore.signal()
23
return
24
}
25
print(String(data: data, encoding: .utf8)!)
26
semaphore.signal()
27
}
28
29
task.resume()
30
semaphore.wait()
31
Copied!
1
var client = new RestClient("https://api.localmail.io/v1/lookup/email");
2
client.Timeout = -1;
3
var request = new RestRequest(Method.POST);
4
request.AddHeader("sid", "{sid}");
5
request.AddHeader("accesskey", "{accesskey}");
6
request.AddHeader("Content-Type", "application/x-www-form-urlencoded");
7
request.AddParameter("email", "[email protected]");
8
IRestResponse response = client.Execute(request);
9
Console.WriteLine(response.Content);
Copied!
Last modified 2mo ago
Copy link