Created
April 1, 2025 10:26
-
-
Save heitara/dabe2bfca31b0737a158e2e5996ca8ea to your computer and use it in GitHub Desktop.
Zoho with Python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import smtplib, ssl | |
host: "smtppro.zoho.eu" | |
smtp_server = "smtppro.zoho.eu" | |
port = 587 # For starttls | |
sender_email = "[email protected]" | |
password = "password" | |
sender_email = "[email protected]" # Enter your address | |
receiver_email = "[email protected]" # Enter receiver address | |
message = """\ | |
Subject: Hi there | |
This message is sent from Python.""" | |
# Create a secure SSL context | |
context = ssl.create_default_context() | |
# Try to log in to server and send email | |
try: | |
server = smtplib.SMTP(smtp_server,port) | |
server.ehlo() # Can be omitted | |
server.starttls(context=context) # Secure the connection | |
server.ehlo() # Can be omitted | |
server.login(sender_email, password) | |
server.sendmail(sender_email, receiver_email, message) | |
except Exception as e: | |
# Print any error messages to stdout | |
print(e) | |
finally: | |
server.quit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment