(
        to_address: str,
        username: str,
        user_email_verified: bool,
        message_id: int,
        from_username: str,
        project_id: int,
        task_id: int,
        subject: str,
        content: str,
        message_type: int,
    )
return True
Send an email to user to alert that they have a new message.
Send an email to user to alert that they have a new message.
Send an email to user to alert that they have a new message .
def send_email_alert(
        to_address: str,
        username: str,
        user_email_verified: bool,
        message_id: int,
        from_username: str,
        project_id: int,
        task_id: int,
        subject: str,
        content: str,
        message_type: int,
    ):
        """Send an email to user to alert that they have a new message."""

        if not user_email_verified:
            return False

        current_app.logger.debug(f"Test if email required {to_address}")
        from_user_link = f"{current_app.config['APP_BASE_URL']}/users/{from_username}"
        project_link = f"{current_app.config['APP_BASE_URL']}/projects/{project_id}"
        task_link = f"{current_app.config['APP_BASE_URL']}/projects/{project_id}/tasks/?search={task_id}"
        settings_url = "{}/settings#notifications".format(
            current_app.config["APP_BASE_URL"]
        )

        if not to_address:
            return False  # Many users will not have supplied email address so return
        message_path = ""
        if message_id is not None:
            message_path = f"/message/{message_id}"

        inbox_url = f"{current_app.config['APP_BASE_URL']}/inbox{message_path}"
        values = {
            "FROM_USER_LINK": from_user_link,
            "FROM_USERNAME": from_username,
            "PROJECT_LINK": project_link,
            "PROJECT_ID": str(project_id) if project_id is not None else None,
            "TASK_LINK": task_link,
            "TASK_ID": str(task_id) if task_id is not None else None,
            "PROFILE_LINK": inbox_url,
            "SETTINGS_LINK": settings_url,
            "CONTENT": format_username_link(content),
            "MESSAGE_TYPE": message_type,
        }
        html_template = get_template("message_alert_en.html", values)
        SMTPService._send_message(to_address, subject, html_template)

        return True
def send_email_alert ( to_address : str , username : str , user_email_verified : bool , message_id : int , from_username : str , project_id : int , task_id : int , subject : str , content : str , message_type : int , ) : if not user_email_verified : return False current_app . logger . debug ( f"Test if email required {to_address}" ) from_user_link = f"{current_app.config['APP_BASE_URL']}/users/{from_username}" project_link = f"{current_app.config['APP_BASE_URL']}/projects/{project_id}" task_link = f"{current_app.config['APP_BASE_URL']}/projects/{project_id}/tasks/?search={task_id}" settings_url = "{}/settings#notifications" . format ( current_app . config [ "APP_BASE_URL" ] ) if not to_address : return False # Many users will not have supplied email address so return message_path = "" if message_id is not None : message_path = f"/message/{message_id}" inbox_url = f"{current_app.config['APP_BASE_URL']}/inbox{message_path}" values = { "FROM_USER_LINK" : from_user_link , "FROM_USERNAME" : from_username , "PROJECT_LINK" : project_link , "PROJECT_ID" : str ( project_id ) if project_id is not None else None , "TASK_LINK" : task_link , "TASK_ID" : str ( task_id ) if task_id is not None else None , "PROFILE_LINK" : inbox_url , "SETTINGS_LINK" : settings_url , "CONTENT" : format_username_link ( content ) , "MESSAGE_TYPE" : message_type , } html_template = get_template ( "message_alert_en.html" , values ) SMTPService . _send_message ( to_address , subject , html_template ) return True