Send SMS using Windows and any GSM Modem
I had a Huawei Mobile Connect Modem lying around in my apartment. Also known as the Globe Tattoo Modem.So let's use it.
You can use any modem or dongle.
As long as it has a sim card with credit load in it.
- Download latest GAMMU for windows (64/x86).
- Install or extract the application to your preferred directory. Personally, We always practice that there are no spaces on the directory names. For example, C:\PERSONAL_EXT\Work\Gammu\bin
SETUP GAMMU AS AN ENVIRONMENT VARIABLEIf you have no idea how to do this, I made a tutorial here on
How to Easily Access any Application from Console.
It is quite intuitive and easy to do. :)
TESTING GAMMUWe have to make sure that Gammu is working well, to do this:
- Open the command prompt. (win+r then type cmd)
- Type: gammu --version
You should see something like this:
Shows we the Gammu version... duh...
Now that Gammu is ready to go, we can now set it to communicate with the GSM Device.
For this, we will need to configure the GAMMURC file properly.
GETTING THE SAMPLE CONFIG FILES
- Let's go to our Gammu directory
- Open \share\doc\gammu\examples\config
- Copy the GAMMURC file to where your gammu.exe file is. (ex. C:\PERSONAL_EXT\Work\Gammu\bin\)
- We can also get a Sample here then copy and put the content to the GAMMURC file in the bin folder
Having multiple device handlers means we can accommodate different SMS providers. If we are planning on creating something Big, then we should maximize this feature of Gammu.
DETERMINE THE COM NUMBER OF A GSM DEVICE
- Right click on My Computer, then click Manage
- Go to the Device Manager, and expand the Ports (COM & LPT) secion.
You should look for something like this...
- Take note on what COM#’s your device is using.
DETERMINE THE GSM CONNECTION TYPEThe connection types vary because of the different protocols gammu uses to "talk" to your devices. Please check Gammu's Config Manual to see what your modem’s connection type is. My modem will just use AT19200 connection
SAMPLE GAMMURC FILEHere is what my gammurc file looks like.
[gammu] device = COM5: connection = at19200 ; Do not use model configuration unless we really need it ;model = 6110 ;synchronizetime = yes ;logfile = gammulog ;logformat = textall ;use_locking = yes ;gammuloc = locfile ;startinfo = yes ;gammucoding = utf8 ;usephonedb = yes
SENDING SMS VIA (CMD) COMMAND LINENow for the fun stuff!
- Open the Command Prompt then type
- gammu -config C:\Directory\to\your\gammurc.file sendsms TEXT "recipient#" -text "message"
You will see something like this
If you see a "500" error message, check your credit balance
and the device's reception.