feat: Add email test script for manual testing
Script sends welcome emails to specified addresses for testing DKIM/SPF/DMARC configuration. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
abded75fb0
commit
c8075e0872
61
scripts/test_email_send.py
Normal file
61
scripts/test_email_send.py
Normal file
@ -0,0 +1,61 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Test wysyłki emaili z noreply@nordabiznes.pl
|
||||
Symuluje email powitalny po założeniu konta.
|
||||
"""
|
||||
import sys
|
||||
import os
|
||||
|
||||
# Add project root to path
|
||||
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
|
||||
from email_service import send_welcome_email, is_configured, init_email_service
|
||||
|
||||
def main():
|
||||
# Ensure email service is initialized
|
||||
if not is_configured():
|
||||
print("❌ Email service nie jest skonfigurowany!")
|
||||
print(" Sprawdź zmienne środowiskowe: AZURE_TENANT_ID, AZURE_CLIENT_ID, AZURE_CLIENT_SECRET, MAIL_FROM")
|
||||
return False
|
||||
|
||||
print("✅ Email service skonfigurowany")
|
||||
|
||||
# Test email addresses
|
||||
test_recipients = [
|
||||
("maciej.pienczyn@inpi.pl", "Maciej (INPI)"),
|
||||
("maciej.pienczyn@altpi.pl", "Maciej (AltPI)"),
|
||||
("maciej.pienczyn@gmail.com", "Maciej (Gmail)"),
|
||||
]
|
||||
|
||||
# Fake verification URL for testing
|
||||
test_verification_url = "https://nordabiznes.pl/verify?token=TEST_TOKEN_123"
|
||||
|
||||
results = []
|
||||
|
||||
for email, name in test_recipients:
|
||||
print(f"\n📧 Wysyłam email testowy do: {email}")
|
||||
success = send_welcome_email(email, name, test_verification_url)
|
||||
|
||||
if success:
|
||||
print(f" ✅ Wysłano pomyślnie!")
|
||||
else:
|
||||
print(f" ❌ Błąd wysyłki!")
|
||||
|
||||
results.append((email, success))
|
||||
|
||||
print("\n" + "="*50)
|
||||
print("PODSUMOWANIE:")
|
||||
print("="*50)
|
||||
|
||||
success_count = sum(1 for _, s in results if s)
|
||||
for email, success in results:
|
||||
status = "✅" if success else "❌"
|
||||
print(f" {status} {email}")
|
||||
|
||||
print(f"\nWysłano: {success_count}/{len(results)}")
|
||||
|
||||
return success_count == len(results)
|
||||
|
||||
if __name__ == "__main__":
|
||||
success = main()
|
||||
sys.exit(0 if success else 1)
|
||||
Loading…
Reference in New Issue
Block a user