- Frontend Produktions-Build aktualisiert. - Test-Skript für Dankes-E-Mails committed.
45 lines
1.9 KiB
Python
45 lines
1.9 KiB
Python
import sys
|
|
import os
|
|
sys.path.append('/app/fotograf-de-scraper/backend')
|
|
|
|
from database import SessionLocal, ReleaseParticipant, DiscountCode
|
|
from gmail_service import GmailService
|
|
from publish_request_api import SIGNATURE_HTML
|
|
|
|
def test_webhook_mail():
|
|
db = SessionLocal()
|
|
|
|
# Simulate data
|
|
test_email = "floke.com@gmail.com"
|
|
first_name = "Christian"
|
|
test_code = "M984AU-TEST"
|
|
|
|
# Simulate logic
|
|
service = GmailService(db)
|
|
subject = "Dankeschön für Eure Freigabe & Euer Rabattcode"
|
|
|
|
INSTRUCTIONS_IMAGE_URL = "https://mail.google.com/mail/u/2?ui=2&ik=719adaa3c5&attid=0.1&permmsgid=msg-a:r7482671925923393616&th=196e322c399dbc7f&view=fimg&fur=ip&permmsgid=msg-a:r7482671925923393616&sz=s0-l75-ft&attbid=ANGjdJ9_U6ayMFgwbupt4HalTKO867IHx6N70eNbPfQmTLNzRXilJxI-n8a1gjM8xVcP5HEOgaVxfp3FnJPzTYmEEyhK4gSU-Il_0a6OtzFYscp55_W4iyxuxjyPvK4&disp=emb&realattid=ii_maspzxv50&zw"
|
|
|
|
body_html = f"""
|
|
<p>Hallo {first_name},</p>
|
|
<p>Vielen Dank nochmal für die Freigabe zur Veröffentlichung, das ist super nett von Euch!</p>
|
|
<p>Hier ist euer Gutscheincode über 25 Euro: <strong style="font-size: 18px; color: #4F46E5;">{test_code}</strong></p>
|
|
<p>Um den Gutschein einzugeben, musst du auf den Preis des Warenkorbs drücken (über dem Button zur Kasse gehen):</p>
|
|
<p><img src="{INSTRUCTIONS_IMAGE_URL}" alt="Anleitung Gutschein einlösen" style="max-width: 100%; border: 1px solid #ddd; border-radius: 8px;"></p>
|
|
<p>Liebe Grüße,<br>das Team von Kinderfotos Erding</p>
|
|
{SIGNATURE_HTML}
|
|
"""
|
|
|
|
print(f"Sende Test-E-Mail an {test_email}...")
|
|
success = service.send_email(test_email, subject, body_html)
|
|
|
|
if success:
|
|
print("✅ E-Mail erfolgreich gesendet! Bitte prüfe dein Postfach.")
|
|
else:
|
|
print("❌ Fehler beim Senden. (Stelle sicher, dass Gmail Authentifiziert ist).")
|
|
|
|
db.close()
|
|
|
|
if __name__ == "__main__":
|
|
test_webhook_mail()
|