Skip to content
Browse files

works. very simple version. can only send txts to tmobile customers r…

…ight now
  • Loading branch information...
1 parent ad3f427 commit eb9b650a072d0362a4cbbc3ed7690c7bb5a2d17d @orangethirty committed Feb 11, 2013
Showing with 66 additions and 3 deletions.
  1. +20 −3 README.md
  2. +6 −0 templates/index.html
  3. +40 −0 web2txt.py
View
23 README.md
@@ -1,4 +1,21 @@
-web2txt
-=======
+teach_txt
+=========
-Allows you to send txt messages from a website.
+Send txt messages from a website using an email account.
+
+The project is being developed to help people message others without having to incur in paying for txt as an API
+service.
+
+
+##Requirements
+
+Flask
+smtplib
+sqlite3
+
+
+##License
+
+GNU GPL
+
+Copyright orangethirty@gmail.com
View
6 templates/index.html
@@ -0,0 +1,6 @@
+<form action="/send" method="POST">
+<label>number</label>
+<input type="text" name="number"><br>
+<label>msg</label>
+<input type="text" name="msg"><br>
+<input type="submit" value="send txt">
View
40 web2txt.py
@@ -0,0 +1,40 @@
+from flask import Flask, request, session, g, redirect, url_for, abort, \
+ render_template, flash, _app_ctx_stack
+
+import smtplib
+
+#List of carriers
+TMOBILE = '@tmomail.net'
+
+
+#email account setup
+USERNAME = 'your_username'
+PASSWORD = 'our_password'
+FROM = 'email@address'
+
+
+#flask setup
+app = Flask(__name__)
+
+
+
+@app.route("/")
+def index():
+ return render_template('index.html')
+
+#send the txt message
+@app.route("/send", methods=['POST'])
+def send():
+ if request.method == 'POST':
+ number = request.form['number']
+ msg = request.form['msg']
+ TO = number + TMOBILE
+ mail = smtplib.SMTP('smtp.gmail.com:587')
+ mail.starttls()
+ mail.login(USERNAME, PASSWORD)
+ mail.sendmail(FROM, TO, msg)
+ mail.quit()
+ return redirect(url_for('index'))
+
+if __name__ == "__main__":
+ app.run()

0 comments on commit eb9b650

Please sign in to comment.
Something went wrong with that request. Please try again.