added scripts for testing smtp and imap
This commit is contained in:
33
smtp-SSL-alinto-dumas.py
Normal file
33
smtp-SSL-alinto-dumas.py
Normal file
@@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env python3
|
||||
import smtplib
|
||||
import ssl
|
||||
|
||||
# Fabrication du corps du email_passwordMessage
|
||||
sender = "sasdumas@entreprise-dumas.com"
|
||||
receiver = "phuoc@caotek.fr"
|
||||
message = """\
|
||||
Subject: Envoi d'un message en SSL
|
||||
|
||||
Voici le contenu du message. Phuoc"""
|
||||
|
||||
# Create a secure SSL context
|
||||
context = ssl.create_default_context()
|
||||
smtp_server = "gatewayxl.alinto.net"
|
||||
smtp_port = 465 # For SSL
|
||||
smtp_user = "smtpsasdumas@entreprise-dumas.com"
|
||||
smtp_pass = "S@sdumas69"
|
||||
|
||||
# Try to log in to server and send email
|
||||
try:
|
||||
server = smtplib.SMTP_SSL(smtp_server, smtp_port, context=context)
|
||||
server.login(smtp_user, smtp_pass)
|
||||
# envoyer l'email
|
||||
server.sendmail(sender, receiver, message)
|
||||
print("sendmail -> OK")
|
||||
|
||||
except Exception as e:
|
||||
# Print any error messages to stdout
|
||||
print(e)
|
||||
finally:
|
||||
server.quit()
|
||||
|
||||
Reference in New Issue
Block a user