CoolFace
Apppublic

Pityumajsaii/Titanium

sourceHugging Faceupdated 5mo agoView on Hugging Face
0likes
money_engine.py66 linesDownload Raw Back to root
1import sqlite3, smtplib, ssl, os, time2from email.mime.text import MIMEText3from dotenv import load_dotenv4 5load_dotenv()6 7EMAIL=os.getenv("EMAIL_USER")8PASS=os.getenv("EMAIL_PASS")9 10DB='titanium.db'11 12def send_mail(to_email, company):13    msg=MIMEText(f"""14Hi {company} team,15 16We help businesses generate more customers using AI automation, lead systems and conversion funnels.17 18Would you be open to a quick intro?19 20Best regards21Titanium Growth22""")23 24    msg["Subject"]="Quick growth idea for "+company25    msg["From"]=EMAIL26    msg["To"]=to_email27 28    ctx=ssl.create_default_context()29 30    with smtplib.SMTP_SSL("smtp.gmail.com",465,context=ctx) as server:31        server.login(EMAIL,PASS)32        server.send_message(msg)33 34def run():35    con=sqlite3.connect(DB, timeout=60)36    try:37        con.execute("PRAGMA journal_mode=WAL")38    except:39        pass40    con.execute("PRAGMA busy_timeout=60000")41    cur=con.cursor()42 43    rows=cur.execute("""44    SELECT id,name,email45    FROM leads46    WHERE status='NEW'47    LIMIT 2548    """).fetchall()49 50    sent=051 52    for row in rows:53        id_,company,email=row54        try:55            send_mail(email,company)56            cur.execute("UPDATE leads SET status='SENT' WHERE id=?",(id_,))57            con.commit()58            print("✅ SENT:",company,email)59            sent+=160            time.sleep(4)61        except Exception as e:62            print("❌ FAIL:",email,e)63 64    print("🔥 DONE:",sent,"emails sent")65 66run()