Created
June 22, 2023 06:58
-
-
Save me-suzy/02cbf992dabd47b58e16bb29f418cb49 to your computer and use it in GitHub Desktop.
Python sending email Cpanel smtp
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
#!/usr/bin/python | |
import sys | |
import smtplib | |
from_addr = '[email protected]' | |
to_addrs = ['[email protected]'] | |
msg = """From: Sender | |
To: Recipient | |
Subject: This is the message subject | |
This is the message body. | |
""" | |
try: | |
s = smtplib.SMTP('localhost') | |
s.login('[email protected]', 'password') | |
s.sendmail(from_addr, to_addrs, msg) | |
s.quit() | |
except smtplib.SMTPException: | |
print "Error:", sys.exc_info()[0] | |
@babblebit.net>@a2example.com> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment