SMS Messaging Using sms-utils
Description
sms-utils package provides a command line utility to send, list, read, delete SMS messages from your mobile device. It also provides utilities for encoding and decoding simple PDUs.
Setup
Copy sms.config.example
to your home directory and edit it as needed.
$ cp /usr/share/sms-utils/sms.config.example ~/.smsconfig $ vi ~/.smsconfig ...
Options found in your local .smsconfig
override the compile time defaults. Command
line options override options in .smsconfig
.
The default modem interface is /dev/modem_at0
. If you are using a PPP connection, you’ll need to use the /dev/modem_at1
interface for SMS.
Sending messages
By default or when interactive mode is enabled and an editor is configured, sending
an SMS will open your editor to create the message. The length of the
message will be truncated without warning to the maximum message length in the
selected alphabet. Seven-bit mode can contain up to 160 characters. Eight-bit mode
can contain up to 140 bytes.
To send an SMS to 1234567890 issue the command:
$ sms send 1234567890
If all goes well there should be no errors or warning messages
printed to stderr and the program should exit with 0.
The validity period is not configurable and will be set to 2 days out from
the time of send.
If the address specified contains any non-digit and non-command characters, the
selected phonebook will be searched for a match. In interactive mode a substring
search is performed and the user is prompted with any matches found. In
non-interactive mode an exact match must be found.
Listing messages
List all stored messages in the selected storage area with this command:
$ sms list all
List only unread messages with this command:
$ sms list unread
The output is in YAML which is both readable and easily parsed.
Reading messages
Read the message at index 1 with this command:
$ sms read 1
After the read command completes the message at index 1 will be
marked as read.
Deleting messages
You can delete a message by its status (unread, read, sent, unsent), by index, or
all messages.
Delete a message at index 1 with this command:
$ sms delete index 1
Delete all messages with this command:
$ sms delete all
Delete only read messages with this command:
$ sms delete read