calcxporte_r is a Rust command-line tool that integrates with the calcure TUI calendar. It reads your scheduled events from calcure's data file, formats them into a styled HTML email, and sends you a daily reminder using the Resend email API.
The application executes the following steps:
- Loads environment variables (API Key, recipient emails) from a
.envfile. - Locates the
calcureevents file at~/.config/calcure/events.csv. - Creates a temporary copy of this file named
events.csvin the project's root directory. It prepends the necessary CSV headers (id,year,month,day,...) to this copy to enable correct parsing, without modifying your originalcalcurefile. - Parses the event data from the temporary CSV file.
- Generates a clean, styled HTML body that lists each event with its date and urgency level. Events marked as
importantare highlighted differently from those markednormal. - Uses the Resend API to send the generated HTML as an email to your configured recipient address.
Before you begin, ensure you have the following:
- Rust: Version 1.65 or higher.
- Calcure: A working installation of
calcurewith events stored in~/.config/calcure/events.csv. - Resend Account: A Resend account with a generated API key and a configured sending domain/email address.
-
Clone the Repository
git clone https://github.com/sponkurtus2/calcxporte_r.git cd calcxporte_r -
Configure Environment Variables Create a
.envfile in the project root by copying the example file:cp .env.example .env
Open the
.envfile and fill in your details:# Your secret API key from Resend. API_KEY=YOUR_RESEND_API_KEY # The email address that will receive the reminder. RECEIVER_EMAIL[email protected] # The "from" email address configured in your Resend account. FROM_RESEND_EMAIL[email protected]
To run the application and send a reminder email, execute the following command from the project's root directory:
cargo run --releaseThe program will read your calcure events and send the email immediately.
For automatic daily reminders, you can schedule the application to run using a cron job.
-
First, build the optimized release binary:
cargo build --release
The executable will be located at
target/release/calcxporteR. -
Open your crontab for editing:
crontab -e
-
Add a new line to schedule the job. The following example runs the application every day at 8:00 AM. Make sure to replace
/path/to/your/projectwith the absolute path to thecalcxporte_rdirectory.# Send calcure email reminder every day at 8:00 AM 0 8 * * * cd /path/to/your/project/calcxporte_r && ./target/release/calcxporteR