Imagine that you are a System Administrator or your business is communicating with clients daily, for example sending information about unpaid invoices or reminders that there is a new invoice. Or you want to inform clients by promoting new products or secure password resets 2FA. You can do that with a TEXT Message ( Known as SMS ). Also, this is a great way to automate your systems and important notifications. The all above-mentioned are pretty easy to implement and do as nowadays mobile carriers in several countries have unlimited texts inside their subscriptions and also prepaid plans.

Once I was curious Is it possible somehow to get the advantage of a free SMS Text that a mobile carrier offers? And yes by doing research I found that there is a great software called wammu, so I started exploring, how it works and found out, that the old 3G/4G Dongle can be used in this case. First thing spending several hours, I got the option that wammu would make me a phone call when a correct command was executed. Then after several times compiling the wammu library I found that it can also send Text messages, but the issue was that if you have around 300 Text messages in 1 minute then wammu hangs the Dongle. So I started to do research from 0 and found Gammu is the same product as wammu, but for my Dongle I could send more than 2000 Text messages in one minute and yes I did a real live test my phone got spammed and no stuck messages, after sending the text messages the Dongle was active and no issues found. So I was running it for 4 months in a test mode to send me each hour a few randomly generated Text messages.

After some time, Since I have Zabbix and Grafana I decided to try creating a Post option using https, so I created a simple index.php that accepts phone numbers and text. Once it receives it it executes the Linux-required command to send the text to the specific phone number. So that was an interesting journey also ( The index.php is added to GitHub and also located inside the Docker container ). So when I was using it I had an old Samsung Laptop that had 250 GB of SSD and 4 GB RAM, not a fancy CPU, but it did the job. And a Huawei LTE USB Stick E3372 + Huawei E367. I would say that on both it works great, but for faster SMS sending I find the E3372 much faster. I think that now you cannot get a new one as they are old, but on eBay, you can get pre-used ones. After some time, since I like Docker and wanted also to host some other applications at home on the same Laptop ( As the resources allowed me ) I decided to move the Gammu to Docker. After doing some research at that time I didn’t find any images available except one that was failing and didn’t work as expected, so I started by creating my own image and it worked without any issue on the above-mentioned loads ( Yes again did a test sending my self over 2000 Text messages to see if all works as expected ). Also, an additional benefit of the Gammu is that it writes all sent Text Messages in a MySQL database and at the same time all received answer messages, This can be used to automate something where the client needs to reply with an answer.

Currently, I’m not using it and didn’t want it to go to waste so I decided to publish it in case someone else needs to automate something by receiving some notifications in text messages or by communicating with clients. With that all, let’s start setting up.

What do you need?
1 A Docker
2 One of the above-mentioned dongles or any of the list of the supported ones
3 MySQL Docker container with created database or a Linux MySQL server with Database < Tutorial can be found here >

1 Connect your device to your Linux machine that runs docker ( It can be done on PC/LAPTOP/Raspberry PI ) or can be also connected to Vmware Proxmox and the port assigned to the Linux Virtual Machine.

2 Check if the device is connected by executing:


When you see your device you can do an

ls -l /dev/ttyUSB

One of the ttyUSB will be the device you need to check which one is the real one.

3 Let’s run our Docker container by executing

docker run --name sms-sender --restart always -i --device=/dev/ttyUSB1 --publish-all -p 802:80 -d valterseu/gammu-sms

-name < you can specify any name, how your container will be named >
-i –device=/dev/ttyUSB1 < Change your USB it can be 1-4 depending on how many USB ports you have and in which one you have plugged into your device or dongle.
-p < You can change to any port since I was using an nginx-reverse proxy then I have set 802 >

Once our container is running we need to change some configuration.
Login to your container docker exec -it container-name bash

In the docker container do: nano /etc/gammu-smsdrc

The gammu-smsdrc is the file, that contains all the gammu configuration, If you make any changes in it you don’t need to do any restarts as it takes the changes straight away. About each parameter, you can read in the Docker Hub by clicking here or in the GitHub by clicking here. But for now, let’s only change the MySQL connection.

# MySQL Connection
service = sql
driver = native_mysql
host = MySQL_HOST
user = MySQL_USER
database = MySQL_DB_NAME

service and drive leave as they are, you only need to change
MySQL_HOST – to your MySQL server hostname or IP if you have a specific port then after the hostname or IP add :port Example
MySQL_USER – your MySQL username that will be used to connect to the Database
MySQL_USER_PASSWORD – Your MySQL user Password that will be used to connect to the Database
MySQL_DB_NAME – your database name
Manual on creating Database, User, and even running MySQL docker container can be found here

The database needs to be already created and the user can log in to MySQL with the credentials that you are providing and have rights to read/write/execute on the DB.

The gammu will automatically create tables that will be used to store outgoing SMS, Incoming SMS, and Sent SMS Messages with a status if they are delivered to the end user.

To send SMS using the Docker terminal


gammu-smsd-inject --config=/etc/gammu-smsdrc TEXT 371222222 -unicode -textutf8 My message

In the above example, we are specifying what config to use for a phone number with country code for example in Latvia 37122222222 you can send worldwide by specifying before the phone number the country code. We are using Unicode textutf8 so that it supports specific characters that are in some languages and My Message is the Message

To send SMS using the Linux terminal

docker exec container-name bash -c 'gammu-smsd-inject --config=/etc/gammu-smsdrc TEXT 371222222 -unicode -textutf8 My message'

Change the container name to your Docker container name

To send SMS using https://

in your browser or in the webhook where you are planning to create it or any type of script execute:


In the above example change the < to your hostname or IP. If you are using an NGINX-REVERSE how-to guide can be found here proxy then the hostname can be used without the port. Change the phone number to your desired remember country code is needed for the phone number and Text%20Message is the text %20 is space between the texts.

And that basically is it the additional configuration you can do in the way you think is best for your project as I have written in the config file what each parameter does. Video tutorial You can find it on my YouTube channel by clicking here

If you have any questions please feel free to contact me on Twitter by clicking here

The GitHub repository of the Docker container containing all the files needed to build a Docker image can be found here

Already built image you can find in the Docker Hub by clicking here
Please feel free to follow me on Youtube. I know the video is not something perfect, but I just started to create videos for Youtube so the quality will be increased. Also, feel free to follow me for updates and interesting things on Twitter. Thanks