Send SMS to mobile

Hello Folks,

I need to send the output from shell script to range of mobile phones based on their msisdn . Is there any open source solution could help me to do so from CentOS or redhat ??

You will need to use someone's SMS gateway service. For example, here is one with an sh based SMS API (using curl ):

https://developer.nexmo.com/messaging/sms/overview

But there are so many APIs like this on the net, and you should deeply research all your options and various APIs available.

my country is not on the list , what shall I do ?

Check other sites for an SMS gateway service which services your country.

For DIY ... you can get a small ARM board with sim slot with linux installed.
Buy a sim card or make a contract, like for regular phone.

Using opensource software such as Gammu you can program your app to send sms via above little box.

Of course, you can always get a sms gateway service online, as suggested.

Hope that helps
Regards
Peasant.

4 Likes

You don't need an SMS gateway, if you know the carrier that the cell phone number is attached to. for example:

number=cell_phone_number
carrier="msg.telus.com"
mail -s "subject" $number@$carrier" <email.message"

You are describing an email to SMS gateway service provided by some carriers.

These types of email to SMS gateways are becoming more and more rare these days, generally speaking.

How about this as a arduino project with an sms board?

See for example, from AliExpress:

https://www.aliexpress.com/item/32989711403.html?spm=a2g0o.productlist.0.0.19994049qDak6v&algo_pvid=a84fac8f-6eb2-43e3-8d6c-4ac160f48550
GPRS SIM900 GSM SMS GPRS communication flip card slot replace SIM900 Through neoway m590 for Arduino

 
 Function modules: 
1. The computer serial port control to send and receive messages, send and receive GPRS data 
2. The single chip microcomputer control to send and receive messages, send and receive GPRS data 
3. The telephone type (no voice part can't talk) 
4. Ringing output 
Current working voltage: 3.7-4.2 V 2 a 
The default baud rate: 115200 

Or maybe this kit, also on AliExpress?

https://www.aliexpress.com/item/32953399908.html?spm=a2g0o.detail.0.0.4d8582fcn1cmUD&gps-id=pcDetailFavMayLike
Features: 
The onboard two set power supply interface VCC5 5V power supply, VCC4 interface, 3.5--4.5V power supply, optional power on self starting (default) and control start.
The onboard SMA (default) and IPXmini antenna interface, SIM900A interface reserved reset.
The size of the module is 49*50, all the new and original device.
The computer can give early computer debugging USB module power supply, a very large amount of data under the condition of the recommended current more than 1A. Standby dozens of MA data can be set to provide dormancy, dormancy of 10MA low power. Support 2, mobile phone 3,4G card.
The serial port circuit: support for 3.3V single chip microcomputer. TTL serial port support
3.3 and 5V single chip microcomputer.
The SIM card circuit to increase the SMF05C ESD chip.
Antenna circuit: guarantee short and straight, so as to ensure the signal strength.
PCB display screen printing mark: each interface, convenient development two times, the SIM900/A hardware is completely follow the design when the design manual.
Two power supply interface: VCC5, 5V DC above 1A. Computer 5V power supply can be early computer USB. DC long data circuit over larger recommended 5V1A. VCC4, 3.5--4.5V power supply, ibid., suitable for lithium battery.
Control pin all leads.
A TTL level, compatible with 3.3V and 5V.
The two antenna interface, the default SMA straight head, connector for IPXmini antenna.
One way of speech interface, the way Mike interface.
The control interface of each pin description:
GND - GND
SIMR SIM900A RXD, TTL level, can not be directly connected to the 232 level
SIMT SIM900A TXD, TTL level, can not be directly connected to the 232 level
RST - SIM900A reset, active low
VCC_MCU when the SIM900A module and 5V TTL level communication, this pin is connected to DC 5V; when the level of communication of SIM900A and 3.3V TTL, this pin is connected to DC 3.3V.
VCC5----DC 5V input.
VCC4------DC3.5--4.5 input
 
Onboard Resources:
Serial port circuit(with protection)
Antenna interface circuit(SMA bend female port)
SIM card circuit(flip SIM slot)
4*3.5 fixture hole 4pcs
SIM900A serial port output terminal
 
Specifications:
Size:49mm x 47mm
Net Weight:28g
Weight: 38g 
 
Package Included:
1 x SIM900A V4.0 kit
1x Power Cable
1x Antenna
1 Like

Or this kit, also on AliExpress:

And here is a basic code example for using the arduino for an SMS project:

https://www.arduino.cc/en/Tutorial/GSMExamplesSendSMS

See also, on AliExpress:

https://www.aliexpress.com/item/32864152187.html

Update:

I have been doing a lot of Device / Server <--> MQTT <--> Node-RED <--> Device / Server / Mobile Phone recently.

In that work, I trying using a number of SMS gateway services; and all worked "slow" and delivered alerts between 1 and 2 minutes after the server sends the alert. Furthermore, their customer agreements (for example nexmo) say "up to 24 hours" to deliver an SMS message.

So, I switch gears and switched to sending messages using Telegram, and it works almost instantly.

Device / Server  <--> MQTT <--> Node-RED <--> Telegram <--> Device / Server / Mobile Phone

The Telegram module for Node-RED works well, although it can be a bit tricky to set up the first time (getting the chatid can be confusing); but after a short learning curve, this is a great combo:

  • Linux server Sends MQTT messages to MQTT broker.
  • Node-RED listens for MQTT topic.
  • Node-RED processes MQTT topic when received; and then,
  • Node-RED sends alert or message via Telegram to mobile phone.

This works well, and is FREE (except for your standard Internet fees, so it is no additional costs for most people).

1 Like