Can it send text messages? You betcha!
You'll be using the SMTP (Simple Mail Transfer Protocol) library. It's the most common protocol for sending mail and its communication is done using TCP.
import smtplibNext, establish a secure session with gmail's outgoing SMTP server using your gmail account. A TLS or SSL connection must be used; the example below uses STARTTLS which is port 587.
server = smtplib.SMTP( "smtp.gmail.com", 587 )Now you're set up to send email. You will send a text message by taking advantage of each mobile carrier's email to SMS gateway!
server.starttls()
server.login( '<gmail_address>', '<gmail_password>' )
For example, to send a text message to a t-mobile number, you would use <number>@tmomail.net. To send a text message to an AT&T number, you would use <number>@mms.att.net.
Once you have your phone destination, all that's left is to add your message and send the mail.
server.sendmail( '<from>', '<number>@tmomail.net', '<msg>' )5 lines of code. Not bad :)