diff --git a/main.py b/main.py
index 8d18e7b729e1ecbe648c05fb694ff17cc66e86a5..89e2b5a87872443b16050d83cd9ac37af0a2184a 100644
--- a/main.py
+++ b/main.py
@@ -1,33 +1,46 @@
 from flask import Flask, render_template, request
 from flask_mail import Mail, Message
+import os
 
 app = Flask(__name__)
+mail = Mail(app)
 
 app.config['MAIL_SERVER'] = 'smtp.gmail.com'
 app.config['MAIL_PORT'] = 587
 app.config['MAIL_USE_TLS'] = True
 app.config['MAIL_USE_SSL'] = False
-app.config['MAIL_USERNAME'] = 'UWEITSTestEmail@gmail.com'
-app.config['MAIL_PASSWORD'] = 'ITPtesting2024'
+app.config['MAIL_USERNAME'] = 'uweitstestemail@gmail.com'
+app.config['MAIL_PASSWORD'] = os.environ.get('its_password')
+mail = Mail(app)
 
-@app.route('/home')
+@app.route('/home', methods=['GET', 'POST'])
 @app.route('/')
 
 def home():
     return render_template('test.html')
 
-#def send_email():
-#    user_firstname = request.form('firstname')
-#    user_lastname = request.form('lastname')
-#    user_email = request.form('UWEemail')
- #   user_issue = request.form('issue')
- #   user_info = request.form('furtherinfo')
+@app.route('/process_form', methods=['POST'])
+def process_data():
+    user_firstname = request.form['firstname']
+    user_lastname = request.form['lastname']
+    user_email = request.form['UWEemail']
+    user_issue = request.form['issue']
+    user_info = request.form['furtherinfo']
 
- #   if 'live.uwe.ac.uk' in user_email:
-  #      if user_issue == 'issue1':
-  #          if 'password' & 'forgot' in user_info:
-                
+    result = send_email(user_email)
+
+    return result
+
+app.route('/send_email', methods=['POST'])
+def send_email(user_email):
+    if 'live.uwe.ac.uk' in user_email:
+        msg = Message("UWE ITS Help Service", sender = 'uweitstestemail@gmail.com', recipients = [user_email])
+        msg.body = "Hi, This is a test email as we are currently prototyping. Thank you for your support."
+        mail.send(msg)
+        return "Email sent."
+    else:
+        return "This email isn't a UWE Email, Goodbye."
 
 
 if __name__ == '__main__':
-    app.run(debug=True)
\ No newline at end of file
+    app.run(debug=True, host='0.0.0.0', port=5000)
\ No newline at end of file
diff --git a/templates/test.html b/templates/test.html
index 0631eb4fd041bac7184678a0b74ac327375358c2..035f61e9ce1d762ea4141dda3badf0df952d2258 100644
--- a/templates/test.html
+++ b/templates/test.html
@@ -8,7 +8,7 @@
 </head>
 
 <body>
-    <form method="post" action="">
+    <form method="post" action="/process_form">
         <div>
             <label for="firstname">First Name:</label>
             <input type="text" id="firstname" placeholder="Please enter your first name" name="firstname" required>