···3636 '';
37373838 msmtp = pkgs.writeShellScriptBin "msmtp" ''
3939- # Check if prism.r is reachable, fallback to Tor if not
4040- if ping -W2 -c1 prism.r >/dev/null 2>&1; then
3939+ # Check if using c-base account (either explicit -a c-base or via From: header)
4040+ using_cbase=0
4141+ for arg in "$@"; do
4242+ if [[ "$arg" == "c-base" ]] || [[ "$arg" =~ @c-base\.org ]]; then
4343+ using_cbase=1
4444+ break
4545+ fi
4646+ done
4747+4848+ # For c-base account, always send directly (no Tor needed)
4949+ if [ "$using_cbase" -eq 1 ]; then
5050+ ${pkgs.coreutils}/bin/tee >(${pkgs.notmuch}/bin/notmuch insert +sent) | \
5151+ ${pkgs.msmtp}/bin/msmtp -C ${msmtprc} "$@"
5252+ # For prism account, check if prism.r is reachable
5353+ elif ping -W2 -c1 prism.r >/dev/null 2>&1; then
4154 ${pkgs.coreutils}/bin/tee >(${pkgs.notmuch}/bin/notmuch insert +sent) | \
4255 ${pkgs.msmtp}/bin/msmtp -C ${msmtprc} "$@"
4356 else
4444- # Build dependencies lazily for Tor fallback
4545- echo "Building tornade and clan-cli for Tor fallback..." >&2
4646- tornade_path=$(nix build --no-link --print-out-paths "${self}#tornade")
4747- clan_path=$(nix build --no-link --print-out-paths "${self}#clan-cli")
4848-4949- # Get tor hostname using clan CLI
5050- tor_hostname=$(CLAN_DIR="${self}" "$clan_path/bin/clan" vars get prism tor-ssh/tor-hostname)
5151-5252- # Use tornade to send via Tor
5353- ${pkgs.coreutils}/bin/tee >(${pkgs.notmuch}/bin/notmuch insert +sent) | \
5454- "$tornade_path/bin/tornade" ssh -T lass@"$tor_hostname" "cat | msmtp -C /etc/msmtprc $*"
5757+ echo "Error: prism.r is not reachable" >&2
5858+ exit 1
5559 fi
5660 '';
5761