#!/usr/bin/env python3
import smtplib, ssl, os
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText

USER, APP = [x.strip() for x in open(os.path.expanduser("~/.aura_csi_smtp")).read().split("\n")[:2]]
TO = "bob.carella@auravision.co"
CC = "plchou@gmail.com"

plain = """Bob,

Following on the reserve top-up — worth connecting the dots, because the shortfall
is exactly the problem Paul built the Compute Recycling program to solve.

Instead of market-buying $LEDGER off the thin Uniswap pool — slippage-heavy, and it
pumps the price against us every time — we post a first-party bid just below market,
no slippage, paid instantly. On a pool this shallow that beats the DEX for any seller
of size: holders get a better exit AND we acquire the inventory you keep needing,
cheaper than buying it on-market. Recycling is the buy side; card + crypto sales are
the sell side. That's the durable way to keep the distributor stocked.

Take a look:
  - Recycle your compute tokens (the program): https://amber.auravision.co/recycle
  - Full economics + caps (internal, keep it close): https://amber.auravision.co/program

For right now we still need the immediate top-up to clear the live launch queue —
but going forward, this is how we refill the reserve without bleeding to slippage.

Aura (CSI)
"""

html = """<div style="font-family:'Chakra Petch',-apple-system,Segoe UI,sans-serif;font-size:15px;color:#1a1510;line-height:1.6">
<p>Bob,</p>
<p>Following on the reserve top-up — worth connecting the dots, because the shortfall is
<b>exactly the problem Paul built the Compute Recycling program to solve.</b></p>
<p>Instead of market-buying $LEDGER off the thin Uniswap pool — slippage-heavy, and it pumps the
price against us every time — we post a first-party bid just below market, no slippage, paid
instantly. On a pool this shallow that beats the DEX for any seller of size: holders get a better
exit <b>and</b> we acquire the inventory you keep needing, cheaper than buying it on-market.
Recycling is the buy side; card + crypto sales are the sell side — that's the durable way to keep
the distributor stocked.</p>
<p style="background:#faf4e8;border-left:3px solid #e8a84a;padding:10px 14px">
&rarr; Recycle your compute tokens (the program): <a href="https://amber.auravision.co/recycle">amber.auravision.co/recycle</a><br>
&rarr; Full economics + caps (internal, keep it close): <a href="https://amber.auravision.co/program">amber.auravision.co/program</a></p>
<p>For right now we still need the immediate top-up to clear the live launch queue — but going
forward, <b>this is how we refill the reserve without bleeding to slippage.</b></p>
<p style="margin-top:18px">Aura <span style="color:#8a7a5c">(CSI)</span></p>
</div>"""

m = MIMEMultipart("alternative")
m["Subject"] = "Re: the reserve — Recycling is how we refill it cheaper"
m["From"] = f"Aura (CSI) <{USER}>"
m["To"] = TO
m["Cc"] = CC
m.attach(MIMEText(plain, "plain"))
m.attach(MIMEText(html, "html"))

ctx = ssl.create_default_context()
s = smtplib.SMTP("smtp.gmail.com", 587, timeout=60)
s.ehlo(); s.starttls(context=ctx); s.ehlo(); s.login(USER, APP)
s.sendmail(USER, [TO, CC], m.as_string()); s.quit()
print(f"SENT from {USER} -> {TO}, cc {CC}")
