from app import app, mail
from flask_mail import Message

with app.app_context():
    try:
        print("Testing contact form email...")
        
        msg = Message(
            subject='Test Contact Form Submission',
            recipients=['info@collnetwork.net'],
            reply_to='test@example.com'
        )
        
        msg.html = """
        <h2>Test Contact Form</h2>
        <p>Name: Test User</p>
        <p>Email: onyegbadocu@fuotuoke.edu.ng/p>
        <p>Message: This is a test message</p>
        """
        
        msg.body = "Test message body"
        
        mail.send(msg)
        print("✅ SUCCESS! Form email sent!")
        
    except Exception as e:
        print(f"❌ ERROR: {e}")
        import traceback
        traceback.print_exc()