Skip to content

Commit

Permalink
Script move, tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
gilgongo committed Dec 8, 2024
1 parent 4304c69 commit 00702de
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
# For testing Xmas emails
# For testing and sending Xmas emails
10 changes: 4 additions & 6 deletions 2024/sender.py → sender.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 00702de

Please sign in to comment.