'Method for sending the registration Email to the user'

def send_email(self, register_user):

    try:
        from flask_mail import Mail, Message
    except:
        log.error('Install    Flask-Mail    to    use    User    registration')
        return False
    mail = Mail(self.appbuilder.get_app)
    msg = Message()
    msg.subject = self.email_subject
    url = url_for('.activation', _external=True, activation_hash=register_user.registration_hash)
    msg.html = self.render_template(self.email_template, url=url, username=register_user.username, first_name=register_user.first_name, last_name=register_user.last_name)
    msg.recipients = [register_user.email]
    try:
        mail.send(msg)
    except Exception as e:
        log.error('Send    email    exception:    {0}'.format(str(e)))
        return False
    return True
