Download and Unzip to files smscmd readme.htm and sms4mail.txt . You can register your email to get password and free SMS to test

 

Shell Sample (Actually, you can just run smscmd.  No shell script required.)

Sample 1 - Account and Password input in Shell Script
# Assume the smscmd command is under /home/david .
# Text and phone # input from console as $1 and $2
#!/bin/bash  
cmd="/home/david/smscmd"
account="registered@sms4mail.com"
pwd="password"
run="$cmd '$1' '$2' '$account' '$pwd' "
eval $run

Sample 2 - Account and Password input from encrypted file smscmd.key
# Assume the smscmd command is under /home/david . Put sms4mail.txt in /home/david and run smscmd genkey first to encrypt password file
# Text and phone # input from console as $1 and $2
#!/bin/bash  
cmd="/home/david/smscmd"
run="$cmd '$1' '$2' "
eval $run

Perl Samle1

#!/usr/bin/perl
# Use smscmd.key or sms4mail.txt as password file. Only need to pass Text and Phone to Perl
system("./smscmd", "$text","$phone");      # Pass $text and $phone from other program or use $ARGV[0], $ARGV[1] from console

Perl sample 2

###################################################################################################################
### Usage: perl perlsms.pl "text" "phone1,phone2" "email" "password"
### sample : perl perlsms.pl "this is a test" "44712335667744" "mymail@mydomain.com" "password"
###################################################################################################################
#!/usr/bin/perl
my $text = $ARGV[0];
my $to = $ARGV[1];
my $email = $ARGV[2];
my $pwd = $ARGV[3];

use HTTP::Request::Common qw(POST);
use LWP::UserAgent;
my $ua = LWP::UserAgent->new;

my $url = "http://www.sms4mail.com/smsmail/php/smscmd.php";
my $req = POST $url, [
Header => 'Content-Type: application/x-www-form-urlencoded',
text => $text,
to => $to,
email => $email,
pwd => $pwd,
];

$resp = $ua->request($req)->as_string;
print "\nResponse back:\n$resp\n";

 

PHP Sample 

<?php

//// call this sample using POST method .  /////////////////////////////////////////////////////////////
$text = $_POST["text"];
$to = $_POST["to"];
$email = $_POST["email"];
$pwd = $_POST["pwd"];
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

$url = "http://www.sms4mail.com/smsmail/php/smscmd.php"; 
$post = array(
"text"=>"$text",
"to" => "$to",
"email"=>"$email",
"pwd"=>"$pwd",
);

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);

// execute
$response = curl_exec($ch);

// close the connection 
curl_close($ch);

// print response
echo "$response";
?>
 

Python Sample

Click here to download Python code and run directly  - Working in x86 and ARM CPU

###################################################################################################################
### pythonsms.py - Python sample from sms4mail.com.
### Usage: python pythonsms.py 'text' 'phone1,phone2' 'email' 'password' 'unicode'
### sample : python pythonsms.py 'this is a test' '44712335667744' 'mymail@mydomain.com' 'password'  '0'
### For Unicode : python pythonsms.py 'this is a test' '44712335667744' 'mymail@mydomain.com' "password' '1'
###################################################################################################################