Easy gateway to send and receive SMS via email. (To be extended to work with other protocols like XMPP or Matrix)
Connect a suitable GSM modem or phone containing the SIM card into a computer (e.g. a Raspberry Pi) at a fixed place. Give sms4you
access (imap and smtp) to one dedicated email address. It will use this connection to receive emails to be sent out as SMS and to send out emails with received SMS messages. The phone number will be managed over the email's subject and only emails are accepted coming from a certain email address.
There can be many reasons, why you want to use sms4you
. Here are some examples:
- You live in the internetz, and you just need a gateway to this old thing "SMS", which some people really still seem to use.
- You travel and use local SIM cards, but still want to be able to receive SMS confirmation codes for banks and services to your usual number.
- You don't want to carry a (registered) SIM card for good reasons and stil be able to send and receive SMS.
sms4you
is implemented as a Python script. It relies on the gammu library for communication via SMS, and uses the libaries imaplib and smtplib to interact with an email address.
-
Install dependencies:
apt-get install gammu python-gammu python-pip python-virtualenv
-
Download the code:
git clone https://github.com/xamanu/sms4you.git
-
Go into the new directory:
cd sms4you
-
Install python dependencies:
pip install -e .
-
Copy and edit the configuration file:
mkdir data && cp env-example data/.env
-
Run the program to check and send emails and sms:
sms4you
-
Probably you want configure a cronjob to check regularily for sms and emails:
* * * * * root sms4you
A simple dockerized setup, based on docker compose.
wget https://raw.githubusercontent.com/xamanu/sms4you/master/docker/docker-compose.yml
- Adjust the environment variables in the downloaded file with your settings.
docker-compose run sms4you