Skip to content

Commit

Permalink
Create send_email_template.py
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremymanning authored Jul 17, 2024
1 parent c1a57aa commit d8e146b
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions template/send_email_template.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText

sender_email = "{sender_email}"
receiver_email = "{admin_emails_str}"
cc_email = "{organizer_emails_str}"
subject = "{event_name} Reminder"

msg = MIMEMultipart()
msg['From'] = sender_email
msg['To'] = receiver_email
msg['Cc'] = cc_email
msg['Subject'] = subject

body = """{announcement_content}"""
msg.attach(MIMEText(body, 'plain'))

server = smtplib.SMTP('smtp.gmail.com', 587)
server.starttls()
server.login(sender_email, "{password}")
text = msg.as_string()
server.sendmail(sender_email, receiver_email.split(", ") + cc_email.split(", "), text)
server.quit()

0 comments on commit d8e146b

Please sign in to comment.