How To
How to test connection to SMTP server
use the commands/script below to test the connection to an smtp server test connection to smtp server to connect using the tls protocol on port 587, use $ openssl s client starttls smtp connect \<smtp server> 587 to use ssl on port 465 $ openssl s client connect \<smtp server> 465 test smtp server credentials and send test email note uses python3 import smtplib, ssl from getpass import getpass from email message import emailmessage port = 25 # 465 ssl, or 587 tls server = '\<smtp server or ip>' sender = '\<smtp email>' password = getpass('type the password and press enter ') recipient = '\<recipient email>' msg = emailmessage() msg\['subject'] = 'smtp e mail test' msg\['from'] = sender msg\['to'] = recipient msg set content('this is a test e mail message ') context = ssl create default context() print(" ") print("test connection with ssl") print(" ") try smtp = smtplib smtp ssl(server, port, context=context) smtp login(sender, password) print("connection successful") \#smtp send message(msg) \#print("email sent successfully check and confirm!") except exception as e print(e) print("\n") print(" ") print("test connection without ssl") print(" ") try smtp = smtplib smtp(server, port) smtp login(sender, password) print("connection successful") \#smtp send message(msg) \#print("email sent successfully check and confirm!") except exception as e print(e) print(" ") print("test connection with tls/ssl") print(" ") try smtp = smtplib smtp(server, port) smtp starttls(context=context) smtp login(sender, password) print("connection successful") \#smtp send message(msg) \#print("email sent successfully check and confirm!") except exception as e print(e)