import smtplib
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
import os
import markdown
def send_premium_test_email():
# SMTP Settings
smtp_host = "smtp.qrmaster.net"
smtp_port = 465
smtp_user = "timo@qrmaster.net"
smtp_pass = "fiesta"
# Recipient
to_email = "knuth.timo@gmail.com"
# Article File Path
article_path = r"c:\Users\a931627\Documents\QRMASTER\articles\seosandwitch-qr-codes-offline-attribution.md"
with open(article_path, "r", encoding="utf-8") as f:
article_content = f.read()
# Professional Markdown to HTML conversion
# Uses 'tables' and 'fenced_code' for perfect formatting
article_html = markdown.markdown(article_content, extensions=['tables', 'fenced_code', 'nl2br'])
subject = "Solving the 'print gap' for small businesses (Draft Included)"
# HTML Template - "Premium Digital Document"
html_template = f"""
Hi Timo,
I noticed your list of free resources for small businesses is one of the more practical ones out there. One category that's often missing: QR code generators.
Instead of just sending a link, I've drafted a comprehensive guide on bridging the 'print gap' using dynamic indicators. I'd love to see this featured on SEO Sandwitch if it aligns with your upcoming content calendar.
The full draft preview is below.
Best,
Timo
(Writer & Strategist)
{article_html}
"""
message = MIMEMultipart()
message["From"] = smtp_user
message["To"] = to_email
message["Subject"] = subject
message.attach(MIMEText(html_template, "html"))
try:
print(f"Connecting to {smtp_host}:{smtp_port} (PREMIUM MODE)...")
with smtplib.SMTP_SSL(smtp_host, smtp_port) as server:
server.login(smtp_user, smtp_pass)
print("Login successful. Sending premium document email...")
server.sendmail(smtp_user, to_email, message.as_string())
print(f"Premium email sent successfully to {to_email}!")
except Exception as e:
print(f"Failed to send email: {e}")
if __name__ == "__main__":
send_premium_test_email()