Skip to content

Instantly share code, notes, and snippets.

@Drvanon
Last active December 19, 2015 04:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Drvanon/5894772 to your computer and use it in GitHub Desktop.
Save Drvanon/5894772 to your computer and use it in GitHub Desktop.
#With mod_rewrite
RewriteEngine on
RewriteRule ^/docs/(.+) http://localhost:5000$1 [R,L]
* cd change directory
* ls list files
* rm remove
* rm -Rf remove directory
* mkdir make directory
* cp copy file
* copy -r copy directory
from flask import Flask, render_template, request
from jemail import send
import json
app = Flask(__name__)
@app.route("/", methods=["GET", "POST"])
def home():
if request.method == "GET":
return render_template("home.html")
name = request.form['name']
email = request.form['email']
content = request.form['content']
send('wachtwoord', content + '\n From: <' + email + '> ' + name)
return json.dumps({
"name": name,
"email": email,
"content": content
})
if __name__ == "__main__":
app.run(debug=True)
-- download and install mod_rewrite for apache
-- append append_this_to_appache.txt to current apache server file
-- Download and install python3.3 and flask
-- Change wachtwoord in flask_server.py
-- Run flask_server.py
-- Be happy :)
import smtplib
def send(password, msg):
fromaddr = 'jejodoremi@gmail.com'
toaddrs = 'jejodoremi@gmail.com'
# Credentials (if needed)
username = 'jejodoremi'
# The actual mail send
server = smtplib.SMTP('smtp.gmail.com:587')
server.starttls()
server.login(username, password)
server.sendmail(fromaddr, toaddrs, msg)
server.quit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment