Develop a Python Flask web application that displays a form for users to enter their name, email address, and phone number. Upon submission, the entered information should be stored in a MySQL database and an email should be sent to the user thanking them for their submission. Use the SQLAlchemy ORM for database operations and the smtplib library for sending emails.
PLAINFORMAT
from flask import Flask, render_template, redirect, url_for, flash
from flask_wtf import FlaskForm
from wtforms import StringField, SubmitField
from wtforms.validators import DataRequired, Email
from models import db, User
from config import Config
import smtplib

app = Flask(__name__)
app.config.from_object(Config)
db.init_app(app)

class RegistrationForm(FlaskForm):
    name = StringField('Name', validators=[DataRequired()])
    email = StringField('Email', validators=[DataRequired(), Email()])
    phone_number = StringField('Phone Number', validators=[DataRequired()])
    submit = SubmitField('Submit')

@app.route('/', methods=['GET', 'POST'])
def index():
    form = RegistrationForm()
    if form.validate_on_submit():
        user = User(name=form.name.data, email=form.email.data, phone_number=form.phone_number.data)
        db.session.add(user)
        db.session.commit()
        send_email(form.email.data)
        flash('Thank you for your submission!', 'success')
        return redirect(url_for('index'))
    return render_template('index.html', form=form)

def send_email(to_email):
    from_email = app.config['MAIL_USERNAME']
    password = app.config['MAIL_PASSWORD']
    subject = "Thank you for your submission"
    body = "Dear user,\n\nThank you for submitting your information. We appreciate your interest.\n\nBest regards,\nThe Team"

    message = f"Subject: {subject}\n\n{body}"

    with smtplib.SMTP(app.config['MAIL_SERVER'], app.config['MAIL_PORT']) as server:
        server.starttls()
        server.login(from_email, password)
        server.sendmail(from_email, to_email, message)

if __name__ == '__main__':
    app.run(debug=True)