From 684ac9f44943e1cf967c171f66295cecd939a4d3 Mon Sep 17 00:00:00 2001 From: hyzen Date: Thu, 14 May 2026 04:45:34 +0530 Subject: [PATCH] Update: URLScan and Lynx --- mutt-add-account.sh | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/mutt-add-account.sh b/mutt-add-account.sh index 06485b2..575043e 100755 --- a/mutt-add-account.sh +++ b/mutt-add-account.sh @@ -18,6 +18,7 @@ unset imap_passive set mail_check = 15 set timeout = 10 set mbox_type=Maildir +set mailcap_path = ~/.mailcap set use_envelope_from = yes set sort=reverse-date set ssl_verify_host = no @@ -34,6 +35,9 @@ source ~/.mutt/vombatidae.neomuttrc # Clear any default mailboxes before loading account configs unmailboxes * +# URLScan +macro index,pager \cb " urlscan" "scan for URLs" + # --------------------------------------------------------------------------- # Static sidebar — all accounts and their folders # --------------------------------------------------------------------------- @@ -79,6 +83,7 @@ SIDEBAR_BLOCK_EOF "set mail_check = 15" "set timeout = 10" "set mbox_type=Maildir" + "set mailcap_path = ~/.mailcap" "set use_envelope_from = yes" "set sort=reverse-date" "set ssl_verify_host = no" @@ -94,6 +99,9 @@ SIDEBAR_BLOCK_EOF "# Clear any default mailboxes before loading account configs" "unmailboxes *" "" + "# URLScan" + "macro index,pager \cb \" urlscan\" \"scan for URLs\"" + "" ) for option in "${required_options[@]}"; do @@ -352,6 +360,17 @@ APPARMOR_EOF sudo systemctl restart apparmor.service 2>/dev/null || echo "Note: Could not restart apparmor service" fi +# Create/update ~/.mailcap with lynx HTML handler +mailcap_file="$HOME/.mailcap" +mailcap_line="text/html; lynx -assume_charset=%{charset} -display_charset=utf-8 -stdin -dump; copiousoutput" +if [ ! -f "$mailcap_file" ]; then + echo "$mailcap_line" > "$mailcap_file" + echo "Created ~/.mailcap" +elif ! grep -qF "$mailcap_line" "$mailcap_file"; then + echo "$mailcap_line" >> "$mailcap_file" + echo "Updated ~/.mailcap" +fi + # Get user inputs read -p "Enter your full email address: " email read -p "Enter your full name: " fullname @@ -651,7 +670,7 @@ if [ "$is_gmail" = true ]; then else # Boxes for goimapnotify (standard) - list of maps with per-box handlers notify_boxes_yaml=" - mailbox: \"INBOX\" - onNewMail: \"mbsync '$email' && notify-send -i mail-unread 'New Mail' '$email' && paplay /usr/share/sounds/freedesktop/stereo/message-new-instant.oga\" + onNewMail: \"mbsync '$email' && MAIL=\$(ls -t ~/Maildir/${shortname}/INBOX/cur/ | head -1) && FROM=\$(grep -m1 '^From:' ~/Maildir/${shortname}/INBOX/cur/\$MAIL | cut -c6-50) && SUBJ=\$(grep -m1 '^Subject:' ~/Maildir/${shortname}/INBOX/cur/\$MAIL | cut -c9-60) && notify-send -i mail-unread 'New Mail - $email' \"\$FROM\n\$SUBJ\" && paplay /usr/share/sounds/freedesktop/stereo/message-new-instant.oga\" onNewMailPost: \"\" onChangedMail: \"mbsync $email\" onChangedMailPost: \"\"