-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_smtp_settings.py
More file actions
103 lines (82 loc) · 3.04 KB
/
Copy pathtest_smtp_settings.py
File metadata and controls
103 lines (82 loc) · 3.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#!/usr/bin/env python3
"""
SMTP Settings Test Script
This script tests the exact SMTP settings provided by the user.
"""
import smtplib
import ssl
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
def test_smtp_settings():
"""Test the provided SMTP settings"""
print("🧪 Testing SMTP Settings...")
# SMTP Configuration from user
smtp_server = "smtpout.secureserver.net"
smtp_port = 465
username = "information@variphi.com"
password = "Nextneural@2402"
print(f" Server: {smtp_server}")
print(f" Port: {smtp_port}")
print(f" Username: {username}")
print(f" SSL: Enabled")
try:
# Create SSL context with relaxed verification
context = ssl.create_default_context()
context.check_hostname = False
context.verify_mode = ssl.CERT_NONE
# Connect to SMTP server
print(f"\n Connecting to {smtp_server}:{smtp_port}...")
server = smtplib.SMTP_SSL(smtp_server, smtp_port, context=context)
# Login
print(f" Logging in with {username}...")
server.login(username, password)
# Test sending a simple email
print(" Sending test email...")
msg = MIMEMultipart()
msg['From'] = username
msg['To'] = username # Send to self for testing
msg['Subject'] = "SMTP Configuration Test - Variphi CRM"
body = """
This is a test email to verify SMTP configuration for Variphi CRM.
SMTP Settings:
- Server: smtpout.secureserver.net
- Port: 465
- SSL: Enabled
- Authentication: Login
If you receive this email, the SMTP configuration is working correctly!
"""
msg.attach(MIMEText(body, 'plain'))
server.send_message(msg)
server.quit()
print("✅ SMTP connection and email sending successful!")
print("📧 Test email sent to information@variphi.com")
return True
except smtplib.SMTPAuthenticationError as e:
print(f"❌ Authentication failed: {e}")
print(" Please check your username and password.")
return False
except smtplib.SMTPConnectError as e:
print(f"❌ Connection failed: {e}")
print(" Please check the server address and port.")
return False
except smtplib.SMTPException as e:
print(f"❌ SMTP error: {e}")
return False
except Exception as e:
print(f"❌ Unexpected error: {e}")
return False
def main():
"""Main function"""
print("🚀 SMTP Settings Test")
print("=" * 40)
success = test_smtp_settings()
print("\n" + "=" * 40)
if success:
print("🎉 SMTP settings are working correctly!")
print("You can now use these settings in your CRM system.")
else:
print("❌ SMTP settings test failed.")
print("Please check your configuration and try again.")
print("=" * 40)
if __name__ == "__main__":
main()