Skip to content

Let klirr email the invoice after generation with klirr invoice --email#13

Merged
Sajjon merged 16 commits intomainfrom
send-email
Jul 6, 2025
Merged

Let klirr email the invoice after generation with klirr invoice --email#13
Sajjon merged 16 commits intomainfrom
send-email

Conversation

@Sajjon
Copy link
Copy Markdown
Owner

@Sajjon Sajjon commented Jul 5, 2025

New feature allowing you to automatically send an email with the invoice after it has been generated. Usage: klirr invoice --email, which will prompt you for an encryption password which protects an SMTP App Password you generate with your email provider.

Setup using: klirr email init

You will be asked to input sender address, smtp server, smtp app password and an encryption password which protects the app password, and more. The smtp app password is saved in encrypted form and is encrypted by an encryption key derived (through HKDF) from the encryption password. Every time you send an email the encryption password will be prompted for. Or optionally you can set the encryption password as an ENV variable.

@codecov
Copy link
Copy Markdown

codecov bot commented Jul 5, 2025

Codecov Report

Attention: Patch coverage is 95.14286% with 17 lines in your changes missing coverage. Please review.

Project coverage is 96.90%. Comparing base (57097c7) to head (e6a6a48).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
crates/core/src/logic/command.rs 87.50% 11 Missing ⚠️
...e/src/models/data/submodels/email/lettre_bridge.rs 90.24% 4 Missing ⚠️
crates/cli/src/input/get_input.rs 93.75% 1 Missing ⚠️
crates/core/src/logic/encryption/aes_gcm_256.rs 95.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #13      +/-   ##
==========================================
- Coverage   97.40%   96.90%   -0.50%     
==========================================
  Files          59       76      +17     
  Lines        1308     1648     +340     
==========================================
+ Hits         1274     1597     +323     
- Misses         34       51      +17     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Sajjon Sajjon requested a review from Copilot July 5, 2025 10:04

This comment was marked as outdated.

… rpassword for safer password input and README update about security.
@Sajjon Sajjon requested a review from Copilot July 5, 2025 11:48

This comment was marked as outdated.

@Sajjon Sajjon requested a review from Copilot July 5, 2025 14:42

This comment was marked as outdated.

@Sajjon Sajjon changed the title Klirr can now send email, use: klirr email test to test Klirr can now send email, use: klirr invoice --email to test Jul 6, 2025
@Sajjon Sajjon changed the title Klirr can now send email, use: klirr invoice --email to test Klirr can now send email with: klirr invoice --email Jul 6, 2025
@Sajjon Sajjon requested a review from Copilot July 6, 2025 08:27
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds end-to-end support for emailing generated invoices via the klirr invoice --email flag.

  • Introduce email settings submodels and persist encrypted SMTP credentials.
  • Implement email composition and sending logic using the lettre crate.
  • Extend the CLI with klirr email commands and integrate email into the invoice command.

Reviewed Changes

Copilot reviewed 50 out of 51 changed files in this pull request and generated no comments.

Show a summary per file
File Description
crates/core/src/models/valid_input.rs Add optional email settings to ValidInput
crates/core/src/models/data/submodels/email/* Define email submodels (settings, template, SMTP)
crates/core/src/logic/send_email.rs Implement functions to send PDF invoices via email
crates/cli/src/input/get_input.rs Add TUI prompts to configure and edit email settings
crates/cli/src/dispatch_command.rs Wire new email commands into CLI dispatch
crates/cli/README.md Document setup and usage of the email feature
Comments suppressed due to low confidence (3)

crates/core/src/models/valid_input.rs:41

  • [nitpick] The field email holds decrypted email settings; for clarity, consider renaming it to email_settings or maybe_email_settings.
    email: Option<DecryptedEmailSettings>,

crates/core/src/logic/send_email.rs:1

  • The new send_email_with_settings_for_pdf and send_email_with_credentials functions lack direct unit tests; consider adding tests or mocks to cover the email-sending logic.
use crate::prelude::*;

crates/core/src/models/data/data_from_disk_with_items_of_kind.rs:98

  • The PathAndName struct is public but lacks a doc comment explaining its purpose; please add documentation for its fields and usage.
pub struct PathAndName {

@Sajjon Sajjon changed the title Klirr can now send email with: klirr invoice --email Let klirr email the invoice after generation with klirr invoice --email Jul 6, 2025
@Sajjon Sajjon merged commit 273bac0 into main Jul 6, 2025
5 of 7 checks passed
@Sajjon Sajjon deleted the send-email branch July 6, 2025 17:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants