-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
5 additions
and
7 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
# For testing Xmas emails | ||
# For testing and sending Xmas emails |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,26 +18,24 @@ def send_email(sender_user, sender_password, recipient_email, subject, html_file | |
message["To"] = recipient_email | ||
message['Date'] = datetime.now().strftime('%a, %d %b %Y %H:%M:%S %z') | ||
|
||
# Create the HTML and plain-text parts of the message | ||
html_part = MIMEText(html_body, "html") | ||
plain_text_part = MIMEText(plain_text_body, "plain") | ||
|
||
# Add the parts to the message | ||
message.attach(plain_text_part) | ||
message.attach(html_part) | ||
|
||
# Create SMTP session | ||
# SMTP details here: | ||
with smtplib.SMTP_SSL("smtp.hatters.org.uk", 465) as smtp: | ||
smtp.login(sender_user, sender_password) | ||
smtp.sendmail(sender_user, recipient_email, message.as_string()) | ||
|
||
# Replace with your actual credentials and email content | ||
# Replace with SMTP auth credentials and email contents | ||
sender_email = "Chrystal Baker-Bates <[email protected]>" | ||
sender_user = "USERNAME" | ||
sender_password = "PASSWORD" | ||
subject = "Test // Happy Christmas 2024 // Test" | ||
html_file = "xmas/2024/version-d.html" | ||
plain_text_file = "xmas/2024/text.txt" | ||
html_file = "2024/version-d.html" | ||
plain_text_file = "2024/text.txt" | ||
|
||
# Read recipient addresses from a file | ||
with open('recipient_addresses.txt', 'r') as f: | ||
|