25 lines
774 B
Python
25 lines
774 B
Python
from flask import Flask, request, Response
|
|
import jinja2
|
|
|
|
app = Flask(__name__)
|
|
env = jinja2.Environment(
|
|
loader=jinja2.FileSystemLoader('templates'),
|
|
autoescape=jinja2.select_autoescape(['xml'])
|
|
)
|
|
|
|
@app.route('/')
|
|
def index():
|
|
return "Mail Autoconfig Service is running."
|
|
|
|
@app.route('/mail/config-v1.1.xml')
|
|
def thunderbird_config():
|
|
domain = request.host.split('.', 1)[1]
|
|
xml = env.get_template('config-v1.1.xml.j2').render(DOMAIN=domain)
|
|
return Response(xml, mimetype='application/xml')
|
|
|
|
@app.route('/Autodiscover/Autodiscover.xml', methods=['POST','GET'])
|
|
def outlook_autodiscover():
|
|
domain = request.host.split('.', 1)[1]
|
|
xml = env.get_template('Autodiscover.xml.j2').render(DOMAIN=domain)
|
|
return Response(xml, mimetype='text/xml')
|