Simple SMS (beta)
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
This page contains an interactive tool which can check if encoding your message in GSM-7 is possible, or if UCS-2 is needed.
CURL
PHP
GO
NODE.JS
PYTHON
RUBY
JAVA
Swift
C#
curl --location --request POST 'https://api.localmail.io/v1/lookup/email' \
--header 'sid: {sid}' \
--header 'accesskey: {accesskey}' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode '[email protected]'
<?php
$sid = "enter your SID token";
$accesskey = "enter your Accesskey token";
$email = "[email protected]";
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.localmail.io/v1/lookup/email',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => $email,
CURLOPT_HTTPHEADER => array(
'sid: $sid',
'accesskey: $accesskey',
'Content-Type: application/x-www-form-urlencoded'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.localmail.io/v1/lookup/email"
method := "POST"
payload := strings.NewReader("[email protected]")
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("sid", "{sid}")
req.Header.Add("accesskey", "{accesskey}")
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://api.localmail.io/v1/lookup/email',
'headers': {
'sid': '{sid}',
'accesskey': '{accesskey}',
'Content-Type': 'application/x-www-form-urlencoded'
},
form: {
'email': '[email protected]'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
import requests
url = "https://api.localmail.io/v1/lookup/email"
payload='[email protected]'
headers = {
'sid': '{sid}',
'accesskey': '{accesskey}',
'Content-Type': 'application/x-www-form-urlencoded'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
require "uri"
require "net/http"
url = URI("https://api.localmail.io/v1/lookup/email")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["sid"] = "{sid}"
request["accesskey"] = "{accesskey}"
request["Content-Type"] = "application/x-www-form-urlencoded"
request.body = "[email protected]"
response = https.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
RequestBody body = RequestBody.create(mediaType, "[email protected]");
Request request = new Request.Builder()
.url("https://api.localmail.io/v1/lookup/email")
.method("POST", body)
.addHeader("sid", "{sid}")
.addHeader("accesskey", "{accesskey}")
.addHeader("Content-Type", "application/x-www-form-urlencoded")
.build();
Response response = client.newCall(request).execute();
import Foundation
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif
var semaphore = DispatchSemaphore (value: 0)
let parameters = "[email protected]"
let postData = parameters.data(using: .utf8)
var request = URLRequest(url: URL(string: "https://api.localmail.io/v1/lookup/email")!,timeoutInterval: Double.infinity)
request.addValue("{sid}", forHTTPHeaderField: "sid")
request.addValue("{accesskey}", forHTTPHeaderField: "accesskey")
request.addValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type")
request.httpMethod = "POST"
request.httpBody = postData
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
semaphore.signal()
return
}
print(String(data: data, encoding: .utf8)!)
semaphore.signal()
}
task.resume()
semaphore.wait()
var client = new RestClient("https://api.localmail.io/v1/lookup/email");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("sid", "{sid}");
request.AddHeader("accesskey", "{accesskey}");
request.AddHeader("Content-Type", "application/x-www-form-urlencoded");
request.AddParameter("email", "[email protected]");
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
Last modified 7mo ago