def send_invite_user_email(self, user, user_invitation):
        """Send the 'user invitation' email."""

        # Verify config settings
        if not self.user_manager.USER_ENABLE_EMAIL: return
        if not self.user_manager.USER_ENABLE_INVITE_USER: return

        # The user param points to the inviter
        # The user_invitation param points to the invitee
        invited_by_user = user

        # Use the invitation email
        email = user_invitation.email

        # Create a dummy user object to an empty name for the invitee
        user = self.user_manager.db_manager.UserClass(email=email)

        # Generate a accept_invitation_link
        token = self.user_manager.generate_token(user_invitation.id)
        accept_invitation_link = url_for('user.register', token=token, _external=True)

        # Render email from templates and send it via the configured EmailAdapter
        self._render_and_send_email(
            email,
            user,
            self.user_manager.USER_INVITE_USER_EMAIL_TEMPLATE,
            accept_invitation_link=accept_invitation_link,
            invited_by_user=invited_by_user,
        )
def send_invite_user_email ( self , user , user_invitation ) : if not self . user_manager . USER_ENABLE_EMAIL : return if not self . user_manager . USER_ENABLE_INVITE_USER : return invited_by_user = user email = user_invitation . email user = self . user_manager . db_manager . UserClass ( email = email ) token = self . user_manager . generate_token ( user_invitation . id ) accept_invitation_link = url_for ( 'user.register' , token = token , _external = True ) self . _render_and_send_email ( email , user , self . user_manager . USER_INVITE_USER_EMAIL_TEMPLATE , accept_invitation_link = accept_invitation_link , invited_by_user = invited_by_user , )
Send the 'user invitation' email.