Send a text file as SMS with a Sony-Ericsson mobile

I thought that sending a text file as a text message through the GSM network’s short message service would be a trivial task either it was performed from within the phone’s operating system or from a computer that runs a flavour of Linux. Once again, I have been badly misled. In 2007, this task still remains a glorious achievement that requires great effort and fantasy in order to be accomplished.

It’s hard to believe that the engineers over at the Sony-Ericsson labs have not taken into account the fact that the phone’s operating system should give the user the opportunity to send the contents of a text file as a text message. I tend to believe that this lack of features is actually on-purpose and has its roots in the company’s marketing department. There is no other logical explanation.

Anyhow, the phone’s internal web browser is the default viewer for plain text files, but this browser will never let you either copy the text in order to paste it in the sms editor or send the file that is being viewed as a text message directly. On the other hand, the phone’s OS will not let you send the file’s contents as text directly either.

…and when things like this happen, it is time for some monkey stuff. I tried to send the contents of the file as SMS through the phone by using two programs, gnokii and gammu, from my fedora desktop. The phone is a Sony-Ericsson K320i. I should state from the beginning that nothing worked.

gnokii & gammu

The bluetooth service (hcid) has been configured properly and the device pairing between the usb dongle and the phone has been accomplished succesfully. Here follow a couple of examples of what I have tried with gnokii and gammu. These are provided for informational purposes only, as nothing worked out. Also, note that the configuration files contain only the absolutely required options in order to work with the phone over the bluetooth interface.

XX:XX:XX:XX:XX:XX represents the phone’s hardware address. Also, channel 2 is used as the rfcomm channel, as the phone’s serial port service “listens” on that channel (see the detailed K320i services over the bluetooth interface).

The gnokii configuration file: /etc/gnokiirc

[global]
port = XX:XX:XX:XX:XX:XX
model = AT
connection = bluetooth
rfcomm_channel = 2

A failed attempt to send the sms directly:

$ echo "test" | gnokii --sendsms +306911111111 -r
GNOKII Version 0.6.14
SMS Send failed (The specified memory is full.)

No, the memory is not full. You make a mistake!

The gammu configuration file: /etc/gammurc

[gammu]
port = XX:XX:XX:XX:XX:XX
connection = blueat

In this example, I will try to save the SMS to an SMS specific folder on the phone. But first, in order to get information about those folders, I issue the command:

$ gammu --getsmsfolders
1. "                         Inbox", SIM memory, Inbox folder
2. "                        Outbox", SIM memory, Outbox folder
3. "                         Inbox", phone memory, Inbox folder
4. "                        Outbox", phone memory, Outbox folder

Then I try to store the message on the phone:

$ echo "test" | gammu --savesms TEXT -folder 4
Saving SMS 1/1
Unknown error.

Ladies and gentlemen… the error is unknown! Unknown error in sight!

Original Monkey Stuff

Having wasted enough time for a single SMS, I started thinking of other ways to get the job done. I noticed that the phone’s OS would let me send calendar appointments, tasks and notes as a text message. So, all I had to do was to save the contents of the text file as one of the aforementioned types of data on the phone.

Although, gnokii and gammu support management of those data types, I did not even try to use either of them.

Instead, I created a task in Evolution, pasted the text file contents in the task descrtiption field and then used multisync (at least this works) in order to transfer the task to the phone. Finally, I sent the task as a text message from the phone’s interface.

I wonder who will give me my wasted time back…

Send a text file as SMS with a Sony-Ericsson mobile by George Notaras is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
Copyright © 2007 - Some Rights Reserved

George Notaras avatar

About George Notaras

George Notaras is the editor of the G-Loaded Journal, a technical blog about Free and Open-Source Software. George, among other things, is an enthusiast self-taught GNU/Linux system administrator. He has created this web site to share the IT knowledge and experience he has gained over the years with other people. George primarily uses CentOS and Fedora. He has also developed some open-source software projects in his spare time.

2 responses on “Send a text file as SMS with a Sony-Ericsson mobile

  1. Budi H. Permalink →

    Dear Goerge,

    You can use following scenario to fix your problem.
    1. Using Gammu
    2. Create your own program that can read your text file and send it to Outbox Folder in Gammu Folder. Make it correct for the file’s name (see Gammu documentation for this thing).
    3. As Gammu identify a file with correct name format in Outbox folder, it will read and send it as usual SMS.

    See you..

    Budi H.

  2. George Notaras Post authorPermalink →

    Hi Budi. At that time I did not have much time to spend reading the whole documentation thoroughly. Despite the errors I liked gammu and I intend to retry the above operation.

    Thanks for the advice and feedback. :-)