×

Discussion Board

Results 1 to 1 of 1
  1. #1
    Registered User
    Join Date
    Aug 2007
    Posts
    3

    Lightbulb Answer to Retrieving SMS Sender Number

    I came across lots of people asking how to retrieve the Sender's number from a received SMS in Python even if the contact is in your contacts database.
    Here is a quick fix:

    Code:
    # Contact Number from Contacts dB
    # XenoArts - John Robert Planta
    
    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)
    
    #change contactName to whatever variable you stored your  ripped contact
    Incorporate this to your code to be able to get the number.
    Good Luck.
    Last edited by xenoflauge; 2007-08-30 at 00:16.

Similar Threads

  1. Retreiving the number of the sender of an sms
    By christee in forum Symbian
    Replies: 1
    Last Post: 2006-04-13, 13:13
  2. How to get sms sender number?
    By cars2003 in forum Symbian
    Replies: 1
    Last Post: 2005-05-12, 12:15
  3. how to email sms specifying a port number?
    By dukehoops in forum General Messaging
    Replies: 2
    Last Post: 2004-04-27, 12:38
  4. when i get the sms how can know the number of sender
    By chinazou305 in forum Symbian Networking & Messaging (Closed)
    Replies: 3
    Last Post: 2003-12-22, 02:56
  5. Replies: 1
    Last Post: 2002-05-10, 18:56

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×