Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

Archived:Messaging in m

From Wiki
Jump to: navigation, search

Archived.pngArchived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.

M on Symbian is not maintained and may not run on current Symbian versions. All M articles have been archived.

Article Metadata
Tested with
Devices(s): Nokia N95, Nokia E90
Platform(s): S60 2nd Edition, S60 3rd Edition, S60 5th Edition
S60 5th Edition
Platform Security
Capabilities: )
Keywords: sms, mms, mail
Created: bogdan.galiceanu (05 May 2009)
Last edited: hamishwillee (09 May 2013)



This article shows how to handle SMS, MMS and e-mail operations in m.


Note: The mail module is not available for S60 2nd Edition.

Note: The send function from the sms module requires the CostComm permission; the send function from the mms requires the CostComm and the Read permissions; the send function from the mail module requires the CostComm and the ReadApp permissions.


Sending an SMS

use sms
sms.send("1234567890", "This is the message")

Waiting for an SMS and displaying it

use sms, time
//Wait for a new SMS to arrive and when it does, store its ID
id = sms.receive()
//Collect information about it
msg = sms.get(id)
//Display the SMS content, sender and time of arrival
content = msg["text"]
sender = msg["sender"]
time = time.str(msg["time"])
print content + "\n"
print "From: " + sender + "\n"
print "Received at: " + time

Deleting all the read messages and setting the unread ones as read

use sms
for id in sms.inbox() do
if sms.get(id)["unread"] = false then sms.delete(id)
else sms.set(id, ["unread":false])


Sending an MMS

use mms
mms.send("1234567890", "Subject", ["C:\\attachment1.jpg", "C:\\attachment2.mp3"])

Waiting for an MMS and saving its attached files

use mms, io
//Wait for a new MMS to arrive and when it does, store its id
id = mms.receive()
//Retrieve the message
msg = mms.get(id)
//Save its attachments
for i = 0 to len(msg["files"]) - 1 do
file_name = msg["files"][i];
file_name = substr(file_name, rindex(file_name, "\\") + 1);
//Create a stream object from the file
j =, i);
//Create an empty file to write to using its stream object
o = io.create("C:\\" + file_name);
//Read 256 characters from the attached file's stream
b =, 256);
while b # null do
//Write the data to the file we created
io.write(o, b);
//Read the next 256 characters from the attached file
b =, 256);
//Close the streams


Sending an email

use mail
mail.send(["to":"", "cc":""], "Subject", "This is the e-mail", ["C:\\attachment.3gp"])


The operations described above are performed.

This page was last modified on 9 May 2013, at 02:52.
42 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.


Thank you!

We appreciate your feedback.