feat(email): Add auto-IP extraction and pre-filled blacklist lookup URLs

- Automatically extract server IP from rejection messages
- Generate pre-filled lookup URLs for top blacklists
- URLs include extracted IP for instant status checking:
  • Spamhaus: https://check.spamhaus.org/?ip=1.2.3.4
  • Barracuda: https://www.barracudacentral.org/rbl/lookup?ip=1.2.3.4
  • SpamCop: https://www.spamcop.net/query.html?ip=1.2.3.4
  • SORBS: http://www.sorbs.net/lookup.shtml?ip=1.2.3.4
- Users no longer need to manually copy IP and search
- Fallback to generic URLs if IP not found in message
- Tested with various IP formats and edge cases

User benefit: Instant access to blacklist status via clickable links

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
cschantz
2026-02-06 16:02:47 -05:00
parent f56df4dc7c
commit 4e03dc5eca
+31
View File
@@ -568,6 +568,12 @@ if [ "$bounced" -gt 0 ]; then
TEMP_BLACKLISTS="/tmp/email_blacklists_$$.txt"
grep -iE "blacklist|block list|RBL|DNSBL|listed in|blocked using|on our block list|S3150|S3140|AS\(48|CS01|local policy|gmail.*(suspicious|reputation|spam|detected).*reputation|gmail.*detected.*suspicious|spamhaus|barracuda|spamcop|sorbs|abuseat|yahoo.*block|yahoo.*reject|aol.*block|aol.*reject|me\.com.*reject|icloud.*reject|mac\.com.*reject|protonmail.*block|protonmail.*reject|pm\.me.*reject|zoho.*block|zoho.*reject|fastmail.*block|fastmail.*reject|outlook.*block|hotmail.*block|live\.com.*block|msn\.com.*block" "$TEMP_BOUNCES" > "$TEMP_BLACKLISTS" 2>/dev/null || true
# Try to extract server IP from rejection messages
extracted_ip=""
if grep -qiE '\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\]|from [0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' "$TEMP_BLACKLISTS" 2>/dev/null; then
extracted_ip=$(grep -oE '\[?[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\]?' "$TEMP_BLACKLISTS" 2>/dev/null | head -1 | tr -d '[]')
fi
if [ -s "$TEMP_BLACKLISTS" ]; then
# Blacklist/Provider detection with real-world message patterns
# Format: "name|display_name|removal_url|detection_keywords"
@@ -627,10 +633,35 @@ if [ "$bounced" -gt 0 ]; then
if [ -n "$detected_blacklists" ]; then
print_warning " ⚠ SPECIFIC BLACKLISTS/BLOCKS DETECTED:"
echo ""
if [ -n "$extracted_ip" ]; then
print_info " Server IP detected: $extracted_ip"
echo ""
fi
echo -e "$detected_blacklists" | sort -u | while IFS='|' read -r bl_name bl_url; do
if [ -n "$bl_name" ]; then
print_error "$bl_name"
# Generate IP-specific lookup URL if IP was extracted
if [ -n "$extracted_ip" ]; then
case "$bl_url" in
*spamhaus.org*)
echo " Lookup: https://check.spamhaus.org/?ip=${extracted_ip}"
;;
*barracudacentral.org*)
echo " Lookup: https://www.barracudacentral.org/rbl/lookup?ip=${extracted_ip}"
;;
*spamcop.net*)
echo " Lookup: https://www.spamcop.net/query.html?ip=${extracted_ip}"
;;
*sorbs.net*)
echo " Lookup: http://www.sorbs.net/lookup.shtml?ip=${extracted_ip}"
;;
*)
echo " Removal/Info: $bl_url"
;;
esac
else
echo " Removal/Info: $bl_url"
fi
echo ""
fi
done