Author Topic: Text via Gmail  (Read 1394 times)

0 Members and 1 Guest are viewing this topic.

Offline techb

  • Soy Sauce Feeler
  • Global Moderator
  • King
  • *
  • Posts: 2350
  • Cookies: 345
  • Aliens do in fact wear hats.
    • View Profile
    • github
Text via Gmail
« on: 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.



Code: [Select]
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()
« Last Edit: October 31, 2011, 12:05:06 pm by techb »
>>>import this
-----------------------------

Offline Rafy

  • Peasant
  • *
  • Posts: 111
  • Cookies: 5
    • View Profile
Re: Text via Gmail
« Reply #1 on: December 06, 2011, 12:27:36 am »
Is this only for us carriers?I need it to work with a european one.
If it moves shoot it,if it runs... hack it!

Offline Tsar

  • Peasant
  • *
  • Posts: 126
  • Cookies: 10
  • turing-recognizable
    • View Profile
Re: Text via Gmail
« Reply #2 on: December 06, 2011, 02:34:13 am »
Cool code, it works (Tested myself but only with 1 email)

Offline Kulverstukas

  • Administrator
  • Zeus
  • *
  • Posts: 6627
  • Cookies: 542
  • Fascist dictator
    • View Profile
    • My blog
Re: Text via Gmail
« Reply #3 on: December 06, 2011, 07:25:39 am »
SMS over email works only for a handful of carriers. Too bad no european ones are supported.