Inbox Module examples
Get Number of the SMS Sender
import contacts #import contact db
db = contacts.open() #store in a variable "db"
def getSenderNum(sms_sender):
found = db.find(sms_sender) #find in database the contact name
try: found #check if found
except NameError:
senderData = found[0]
senderNum = senderData.find("mobile_number")[0].value
else:
senderNum = sms_sender
return senderNum
#now all you have to do is assign a variable the number of that contact name
mobileNum = getSenderNum(contactName)
Read an incoming SMS
import inbox
i = inbox.Inbox()
m = i.sms_messages() # all message ID's
content_m=i.content(m[0]) # first message
print i.time(m[0]) # arrive time
print "_______________"
print i.address(m[0]) # Only name is given :(
print"---------------"
Read and delete an incoming SMS
import inbox
i = inbox.Inbox()
m = i.sms_messages() # all message ID's
content_m=i.content(m[0]) # first message
print i.time(m[0]) # arrive time
print "_______________"
print i.address(m[0]) # Only name is given :(
print"---------------"
i.delete(m[0]) # delete first message
#change contactName to whatever variable you stored your ripped contact