# Daily Tech Digest — HTML Email with Clickable Headlines The script at `/root/.hermes/scripts/daily-feed-summary.py` collects RSS feeds (XDA, MakeUseOf, How-To Geek, 9to5Mac, HotHardware, Gizmodo, Top Gear) and sends Germaine a daily digest. ## Problem: headlines not clickable The original script sent a `MIMEText(body, 'plain')` message. Markdown links `[title](url)` rendered as literal text — the user had to copy-paste URLs manually. ## Fix: multipart/alternative with markdown-to-HTML conversion ```python from email.mime.text import MIMEText from email.mime.multipart import MIMEMultipart import re def markdown_to_html(text): """Convert markdown links, bold, italic, headers to email-safe HTML.""" # Links: [text](url) → text html = re.sub( r'\[([^\]]+)\]\(([^)]+)\)', r'\1', text ) # Bold: **text** → text html = re.sub(r'\*\*([^*]+)\*\*', r'\1', html) # Italic: _text_ → text html = re.sub(r'_([^_]+)_', r'\1', html) # H2: ## Header html = re.sub(r'^## (.+)$', r'

\1

', html, flags=re.MULTILINE) # H1: # Header html = re.sub(r'^# (.+)$', r'

\1

', html, flags=re.MULTILINE) # HR: --- html = re.sub(r'^---+$', r'
', html, flags=re.MULTILINE) return html def send_html_digest(plain_body, subject): """Send multipart/alternative digest.""" html_content = f'''
{plain_body}
''' msg = MIMEMultipart('alternative') msg['Subject'] = subject msg['From'] = 'g@germainebrown.com' msg['To'] = 'g@germainebrown.com' msg.attach(MIMEText(plain_body, 'plain', 'utf-8')) msg.attach(MIMEText(html_content, 'html', 'utf-8')) # ... SMTP send via port 2525 ``` ## Key design decisions - **multipart/alternative** — includes both text/plain (for clients that can't render HTML) and text/html (for clickable links) - **Inline styles** — email clients strip `