def send_password_change_message(self, user, base_url):
        """ Send password change message"""
        subject = 'Change your password here'
        if 'password_change' in self.email_subjects.keys():
            subject = self.email_subjects['password_change']

        sender = current_app.config['MAIL_DEFAULT_SENDER']
        recipient = user.email
        link = '{url}/{link}/'.format(
            url=base_url.rstrip('/'),
            link=user.password_link
        )
        data = dict(link=link)
        html = render_template('user/mail/password-change.html', **data)
        txt = render_template('user/mail/password-change.txt', **data)

        mail.send(Message(
            subject=subject,
            recipients=[recipient],
            body=txt,
            html=html,
            sender=sender
        ))
def send_password_change_message ( self , user , base_url ) : subject = 'Change your password here' if 'password_change' in self . email_subjects . keys ( ) : subject = self . email_subjects [ 'password_change' ] sender = current_app . config [ 'MAIL_DEFAULT_SENDER' ] recipient = user . email link = '{url}/{link}/' . format ( url = base_url . rstrip ( '/' ) , link = user . password_link ) data = dict ( link = link ) html = render_template ( 'user/mail/password-change.html' , ** data ) txt = render_template ( 'user/mail/password-change.txt' , ** data ) mail . send ( Message ( subject = subject , recipients = [ recipient ] , body = txt , html = html , sender = sender ) )
Send password change message