How to Send a Cell Phone a Text Message With a Python Script

Written by christopher hanson
  • Share
  • Tweet
  • Share
  • Pin
  • Email
How to Send a Cell Phone a Text Message With a Python Script
The Python programming language enables programmers to easily send mass text messages. (New message on 3d rendered cell phone image by Franc Podgor...¡ek from Fotolia.com)

An SMS message, also known as a text message, is essentially an e-mail sent to a mobile phone. The capacity to communicate between computers and cell phones via SMS messaging is increasingly important. Google has developed a library that communicates with the Python programming language allowing programmers to access Gmail accounts. Programmers use the Gmail account as a launching point for SMS messages. Gmail accounts are ideal for mass text messaging because they have a large capacity for responses.

Skill level:
Moderate

Other People Are Reading

Instructions

  1. 1

    Sign up for a Gmail account by filling out the form.

  2. 2

    Download the latest version of the Google library for Python.

  3. 3

    Right click the zip file and select "Extract." A dialogue box will pop up requesting a target location to extract the zip file. Select the "Documents" directory and click "Extract."

  4. 4

    Launch the Microsoft command prompt. Click "Start," "Run," then type "CMD.EXE" and press "Enter."

  5. 5

    Move to the library directory. At the command prompt, type "cd c:\Documents\gdata-2.0.12" then press "Enter."

  6. 6

    Build and install the library. At the command prompt, type "python setup.py build" then press "Enter." Type "python.py install" then press "Enter."

  7. 7

    Launch the Python line editor. At the command prompt, type "python" then press "Enter." The prompt will change to ">>>" to indicate that the Python editor is active.

  8. 8

    Import the Gmail library and text message module. At the command prompt, type "import libgmail" then press "Enter." Type "from TextMessaging import *" then press "Enter."

  9. 9

    Register the sender information. At the command prompt, type:

    sender = Sender("<GMAIL_USER>", "<GMAIL_PASS>")

    Replace <GMAIL_USER> with the login name from the Gmail account. Replace <GMAIL_PASS> with the password for the Gmail account then press "Enter."

  10. 10

    Register the text message information. At the command prompt, type:

    smsMessage = TextMessage("<SUBJECT>", "<BODY>")

    Replace <SUBJECT> with the subject of the message. Replace <BODY> with the body of the message then press "Enter."

  11. 11

    Register the carrier data. At the command prompt, type:

    CARRIERS = {"Alltel":"alltelmessage.com",

            "ATT":"mobile.mycingular.com",
    
            "Rogers":"pcs.rogers.com",
    
            "Sprint":"messaging.sprintpcs.com",
    
            "tMobile":"t-mobile.net",
    
            "Telus":"msg.telus.com",
    
            "Verizon":"vtext.com"}
    

    then press "Enter."

  12. 12

    Register the receiver of the text message. At the command prompt, type:

    receiver = Receiver("<PHONE NUMBER>", "<CARRIER>")

    Replace <PHONE NUMBER> with the phone number of the person who will receive the text message. Replace <CARRIER> with the name of the carrier the person uses. Make sure to type the carrier name exactly the way it appears in the step where the carrier was registered. The carrier name is case sensitive.

  13. 13

    Send the message. At the command prompt, type:

    sender.sendMessage(receiver, smsMessage)

    then press "Enter."

Don't Miss

Filter:
  • All types
  • Articles
  • Slideshows
  • Videos
Sort:
  • Most relevant
  • Most popular
  • Most recent

No articles available

No slideshows available

No videos available

By using the eHow.co.uk site, you consent to the use of cookies. For more information, please see our Cookie policy.