EvilZone

Programming and Scripting => Scripting Languages => : techb October 31, 2011, 12:02:34 PM

: Text via Gmail
: techb October 31, 2011, 12:02:34 PM
Thought this might interest some people. It's an example of using SMTP for texting. Requires a Gmail account though. Throw it in a loop and BAM!!!!! Text bomb. I think there is a limit though. The most I've ever sent in a row where around 150. My brother hated me that night lol.


I do plan on updating this with a GUI, logging, address book, conversation tracking, etc... Since at my house I don't get any cell service, this comes in handy. Might make a port to android too, so you can text through WiFi if you have no cell service.



:
carriers = {"Alltel":"@message.alltel.com",
                  "ATT":"@txt.att.net",
                  "NEXTEL":"@messaging.nextel.com",
                  "SPRI":"@messaging.sprintpcs.com",
                  "TMOBILE":"@tmomail.net",
                  "VERIS":"@vtext.com",
                  "VERGIN":"@vmobl.com"}


#replace 5555555555 with a working number and correct carrier address
def sendText(body, to = "5555555555@txt.att.net", username = "yourAccount@gmail.com", password = "Your password"):
    """Sends a text via Gmail"""
    mail_server = smtplib.SMTP("smtp.gmail.com", 587)
    mail_server.ehlo() mail_server.starttls()
    mail_server.ehlo()
    mail_server.login(username, password)
    mail_server.sendmail(username, to, body) mail_server.close()
: Re: Text via Gmail
: Rafy December 06, 2011, 12:27:36 AM
Is this only for us carriers?I need it to work with a european one.
: Re: Text via Gmail
: Tsar December 06, 2011, 02:34:13 AM
Cool code, it works (Tested myself but only with 1 email)
: Re: Text via Gmail
: Kulverstukas December 06, 2011, 07:25:39 AM
SMS over email works only for a handful of carriers. Too bad no european ones are supported.