Untitled
unknown
plain_text
a year ago
1.1 kB
2
Indexable
Never
import smtplib,ssl # Email account information sender_email = "support@srena.com" # Replace with your email address password = "****" # Replace with your email password receiver_email = "hbariya.elluminati@gmail.com" # Replace with the recipient's email address # SMTP server information smtp_server = "chinkara.websitewelcome.com" # Replace with your SMTP server address from email.message import EmailMessage message = EmailMessage() message['Subject'] = 'Hi there' message['From'] = sender_email message['To'] = receiver_email message.set_content("""\ This message is sent from Python.""") port = 587 # Replace with the appropriate port for your email service # Establish a secure connection with the SMTP server try: context = ssl.create_default_context() with smtplib.SMTP(smtp_server, port) as server: server.ehlo() # Can be omitted server.starttls(context=context) server.ehlo() # Can be omitted server.login(sender_email, password) server.send_message(message) except Exception as e: print(f"An error occurred: {str(e)}")