Index: src/mapservice/codegen/code_generator
===================================================================
--- src/mapservice/codegen/code_generator	(revision 306f18abba2b16f6dac320d5b2582227b373c0e6)
+++ src/mapservice/codegen/code_generator	(revision bd0cb38e900c943ced620072feb0270b34682037)
@@ -25,4 +25,6 @@
 cp -a ../../../common/resources/* static/resources/
 cp -a ../../../common/icon/* static/resources/
+mkdir -p templates
+cp -a ../../templates/* templates/
 
 echo "Generating backend and client API code"
Index: src/mapservice/codegen/templates/__init__.mustache
===================================================================
--- src/mapservice/codegen/templates/__init__.mustache	(revision 306f18abba2b16f6dac320d5b2582227b373c0e6)
+++ src/mapservice/codegen/templates/__init__.mustache	(revision bd0cb38e900c943ced620072feb0270b34682037)
@@ -0,0 +1,8 @@
+import connexion
+from flask_cors import CORS
+from flask_mail import Mail
+
+app = connexion.App(__name__, specification_dir='./openapi/')
+application = app.app
+CORS(application)
+mail = Mail()
Index: src/mapservice/codegen/templates/__main__.mustache
===================================================================
--- src/mapservice/codegen/templates/__main__.mustache	(revision 306f18abba2b16f6dac320d5b2582227b373c0e6)
+++ src/mapservice/codegen/templates/__main__.mustache	(revision bd0cb38e900c943ced620072feb0270b34682037)
@@ -6,19 +6,10 @@
 {{/supportPython2}}
 
-import connexion
-from flask_cors import CORS
-#from flask import render_template
 import flask
 from sqlalchemy import event
 
-from {{packageName}} import encoder
-
+from {{packageName}} import encoder, app, application, mail
 from {{packageName}}.server_impl.database.Model import db, User, ApiKey, db_setup, db_test_setup
-
 from {{packageName}}.server_impl.ValidatorWorkaround import ValidatorWorkaround
-
-app = connexion.App(__name__, specification_dir='./openapi/')
-application = app.app
-CORS(application)
 
 @application.before_first_request
@@ -46,4 +37,5 @@
 
 	db.init_app(application)
+	mail.init_app(application)
 
 	app.run(port={{serverPort}})
Index: src/mapservice/codegen/templates/requirements.mustache
===================================================================
--- src/mapservice/codegen/templates/requirements.mustache	(revision 306f18abba2b16f6dac320d5b2582227b373c0e6)
+++ src/mapservice/codegen/templates/requirements.mustache	(revision bd0cb38e900c943ced620072feb0270b34682037)
@@ -8,4 +8,5 @@
 flask-sqlalchemy
 flask-cors
+flask-mail
 shapely
 geoalchemy2
