A simple offline mail file viewer written in python
- Python 3.12 (recommended)
- Git (to clone the repository)
See requirements.txt for the Python dependencies used by the project.
-
Clone the repository:
git clone https://github.com/AlstonChan/py-mailbox-viewer.git cd py-mailbox-viewer -
Create a virtual environment (recommended):
# Using the system Python launcher py -3.12 -m venv .venv # Or using the active `python` executable python -m venv .venv
-
Activate the virtual environment:
# PowerShell (recommended) .\.venv\Scripts\Activate.ps1 # Command Prompt (cmd.exe) .\.venv\Scripts\activate.bat # Git Bash / MSYS / Unix source .venv/bin/activate
-
Upgrade pip and install dependencies:
py -m pip install --upgrade pip py -m pip install -r requirements.txt
If you used python -m venv instead of py -3.12, replace the py -3.12 -m pip calls with the python from the activated venv.
Run the application with py ./src/app.py
After a new resources has been added to the resources directory, you have to update the resources.qrc file to include the new entry of resource or remove the delete resource entry. Then re-compile the resources_rc file with:
pyside6-rcc resources.qrc -o src/resources_rc.pyThis repository includes an app.spec that can be used with PyInstaller to create a standalone application bundle on Windows and Linux.
General steps (Windows / Linux):
-
Create and activate a virtual environment and install dependencies:
# Windows (PowerShell / cmd) or Linux/macOS (use the appropriate python launcher) python -m venv .venv # activate the venv (platform-specific) # PowerShell: .\.venv\Scripts\Activate.ps1 # cmd.exe: .\.venv\Scripts\activate.bat # Linux/macOS: source .venv/bin/activate python -m pip install --upgrade pip python -m pip install -r requirements.txt
-
(If resources changed) Compile Qt resources into Python:
pyside6-rcc resources.qrc -o src/resources_rc.py
-
Build with
pyinstallerusing the included spec file:pyinstaller app.spec
pyinstaller will create the standard build artifacts and distributions (build/, dist/) in the repository root. The bundled application will be placed under dist/py-mailbox-viewer.
If you want to produce a Linux AppImage for redistribution, the typical workflow is:
-
Build the application bundle with PyInstaller on a Linux host (use the same spec used earlier):
pyinstaller app.spec
-
Install the
appimagetoolbinarywget https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage # Make it executable chmod +x appimagetool-x86_64.AppImage # move it into /usr/local/bin sudo mv appimagetool-x86_64.AppImage /usr/local/bin/appimagetool
-
Prepare the directory for packaging
mkdir -p "packaging/AppImage/usr/bin" # Copy the PyInstaller dist output into usr/bin cp -r dist/py-mailbox-viewer/* "packaging/AppImage/usr/bin/"
-
Run the packaging
appimagetool "packaging/AppImage"
This will produce a app image file - Py_Mailbox_Viewer-x86_64.AppImage
- RFC5322 - Defines how an email header should be