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


Unzip and Run directly in Linux Shell

Sample 1 : account and password input directly

root@vultr:~/smscmd# ls -al
total 48
drwxr-xr-x 2 root root 4096 Jan 12 04:27 .
drwx------ 10 root root 4096 Jan 12 04:23 ..
-rw-r--r-- 1 root root 4045 Oct 20 2017 readme.htm
-rw-r--r-- 1 root root 28 Oct 20 2017 sms4mail.txt
-rwxr-xr-x 1 root root 21848 May 2 2019 smscmd
-rw-r--r-- 1 root root 7467 Jan 12 04:27 smscmd_linux.zip
root@vultr:~/smscmd# ./smscmd
smscmd V3.0 for Linux. Register your email to get password and free SMS to test on sms4mail.com
Usage1:
smscmd "text" "phone1,phone2,phone3" "email" "password"
Usage2:
smscmd "text" "phone1,phone2,phone3"
Password file smscmd.key or sms4mail.txt must be in the same directory with smscmd
You can run "smscmd genkey" to generate smscmd.key from sms4mail.txt to protect your password
Copy smscmd and smscmd.key to anywhere to send SMS securely
Refer readme.htm for detail

root@vultr:~/smscmd# ./smscmd "this is a test" "4357501234,+447748071234" "registered@hotmail.com" "password1234"
Message sent. SMS text [this is a test] sent to [4357501234,+447748071234]
 

Sample 2 : account and password from encrypted file (vi to update your account and password in file sms4mail.txt first)

root@vultr:~/smscmd# vi sms4mail.txt
root@vultr:~/smscmd# ./smscmd genkey
smscmd genkey to generate smscmd.key successfully
root@vultr:~/smscmd# rm sms4mail.txt
root@vultr:~/smscmd# ./smscmd "this is a test password from encrypted file" "4357501234,+447748071234"
Message sent. SMS text [this is a test password from encrypted file] sent to [4357501234,+447748071234]
 


curl command sample. run under Linux command prompt or called by other program (Keep same format, change xxxxxxxx to your own)

curl -d "email=xxxxxxx@xxxxxxx.xxx&pwd=xxxxxxxxx&text=xxxxxxxxxxxxxx&to=xxxxxxxxxxxxxx" -X POST https://www.sms4mail.com/smsmail/php/smscmd.php

 


Perl Samle1 Call smscmd and use encrypted password file smscmd.key download this sample code
#!/usr/bin/perl
#Download smscmd_linux.zip from sms4mail.com/download/linux/smscmd_linux.zip
#Update email and password in sms4mail.txt and run ./smscmd genkey to encrypt password file to smscmd.key
#Remove password file sms4mail.txt
if ($#ARGV <=0)
{
print "\n smscmd for PERL -- sms4mail.com";
print "\n\n perl smscmd.pl 'text' 'phone1,phone2'";
print "\n\n Download smscmd_linux.zip from sms4mail.com/download/linux/smscmd_linux.zip first";
print "\n Unzip and update email and password file sms4mail.txt";
print "\n Run smscmd genkey to generate encrypted password file smscmd.key";
print "\n Remove sms4mail.txt for safety\n\n";
exit(0);
}
my $cmd = "./smscmd " . "'" . $ARGV[0] . "' '" . $ARGV[1] . "'";
system($cmd);
print "SMS sent finished\n";
exit(0);

Perl sample 2
###################################################################################################################
### Usage: perl perlsms.pl "text" "phone1,phone2" "email" "password"
### sample to local # 3478254321 and global +44712335667744 :
###  perl perlsms.pl "this is a test" "3478254321,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 Samle1 Call smscmd and use encrypted password file smscmd.key download this sample code

<?php
//Download smscmd_linux.zip from sms4mail.com/download/linux/smscmd_linux.zip
//Update email and password in sms4mail.txt and run ./smscmd genkey to encrypt password file to smscmd.key
//Remove password file sms4mail.txt
if ($argc <=2) //print help
{
print ("\n smscmd for PHP -- sms4mail.com\n");
print ("\n php smscmd.php 'text' 'phone1,phone2'\n");
print ("\n Download smscmd_linux.zip from sms4mail.com/download/linux/smscmd_linux.zip first");
print ("\n Unzip and update email and password file sms4mail.txt");
print ("\n Run smscmd genkey to generate encrypted password file smscmd.key");
print ("\n Remove sms4mail.txt for safety\n\n");

exit;
}
$cmd = "./smscmd '$argv[1]' ' $argv[2]'";
$ret = shell_exec($cmd);
echo("$ret");
?>

PHP Sample2 

<?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 Samle1 Call smscmd and use encrypted password file smscmd.key download this sample code

#!/usr/bin/env python
#coding=utf8
import sys,os
if len(sys.argv) <= 2 or sys.argv[1] == 'help':
    print('''\
     smscmd for python -- sms4mail.com
     python smscmd.py 'text' 'phone1,phone2'
     Download smscmd_linux.zip from sms4mail.com/download/linux/smscmd_linux.zip first
     Unzip and update email and password file sms4mail.txt
     Run smscmd genkey to generate encrypted password file smscmd.key
     Remove sms4mail.txt for safety
    ''')
    sys.exit(1)
text = sys.argv[1]
to = sys.argv[2]
os.system('./smscmd "' + text + '" "' + to + '"')
print("SMS sent finished")

 

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

###################################################################################################################
### pythonsms.py - Python sample from sms4mail.com.
### Usage: python smscmd.py 'text' 'phone1,phone2' 'email' 'password' 
### Sample to local # 3478254321 and global +44712335667744 :
### default non unicode :   python smscmd.py 'this is a test'  '3478254321,+44712335667744'  'mymail@mydomain.com'  'password'
### for unicode                 :   python smscmd.py 'this is a test'  '3478254321,+44712335667744'  'mymail@mydomain.com'  'password'  '1'
###################################################################################################################