#!/usr/bin/env python3 """Send email from Sho'Nuff Brown with signature + BCC to Germaine + IMAP Sent copy.""" import smtplib, random, importlib.util, imaplib, ssl, time, email from email.mime.text import MIMEText from email.mime.multipart import MIMEMultipart SHONUFF_PASS = "Catches.bullets1985" def send(to, subject, body, cc=None): spec = importlib.util.spec_from_file_location("closings", "/root/.hermes/references/shonuff-closings.py") mod = importlib.util.module_from_spec(spec) spec.loader.exec_module(mod) closing = random.choice(mod.SHONUFF_CLOSINGS) spec2 = importlib.util.spec_from_file_location("titles", "/root/.hermes/references/shonuff-titles.py") mod2 = importlib.util.module_from_spec(spec2) spec2.loader.exec_module(mod2) title = random.choice(mod2.SHONUFF_TITLES) b64 = open("/root/.hermes/references/shonuff-image-b64.txt").read().strip() sig = open("/root/.hermes/references/shonuff-email-signature.html").read() sig = sig.replace("%SHONUFF_IMAGE%", b64).replace("%SHONUFF_TITLE%", title) msg = MIMEMultipart("alternative") msg["From"] = "shonuff@germainebrown.com" msg["To"] = to msg["Bcc"] = "g@germainebrown.com" msg["Subject"] = subject text = MIMEText(f"{body}\n\n{closing}\n\n-- \nSho'Nuff Brown\nGermaine's AI Ops Engineer\nIT Pro Partner\nshonuff@germainebrown.com", "plain") html = MIMEText(f"

{body.replace(chr(10), '
')}

{closing}

{sig}", "html") msg.attach(text) msg.attach(html) # Send via SMTP with smtplib.SMTP("mail.germainebrown.com", 2525) as s: s.starttls() s.login("shonuff@germainebrown.com", SHONUFF_PASS) s.send_message(msg) # Save copy to Sent folder via IMAP try: ctx = ssl.create_default_context() imap = imaplib.IMAP4_SSL("mail.germainebrown.com", 993, ssl_context=ctx, timeout=10) imap.login("shonuff@germainebrown.com", SHONUFF_PASS) imap.append("Sent", None, None, msg.as_bytes()) imap.logout() except Exception as e: print(f"[WARN] Sent copy not saved: {e}") print(f"Sent to {to} — BCC'd g@germainebrown.com — Sent copy saved") if __name__ == "__main__": import sys if len(sys.argv) >= 4: send(sys.argv[1], sys.argv[2], sys.argv[3]) else: print("Usage: send-shonuff.py ")