Created
June 8, 2023 01:52
-
-
Save ajsya/8b4ef0b6611b670d6ffd361a4f8b094b to your computer and use it in GitHub Desktop.
Google Bard Wrote This
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
import smtplib | |
def send_email(sender, recipient, subject, message): | |
# Create a secure SMTP connection | |
smtp = smtplib.SMTP('smtp.gmail.com', 587) | |
smtp.ehlo() | |
smtp.starttls() | |
# Login with your email and password | |
smtp.login(sender, 'Your Password') | |
# Send the email | |
msg = MIMEMultipart() | |
msg['From'] = sender | |
msg['To'] = recipient | |
msg['Subject'] = subject | |
msg.attach(MIMEText(message)) | |
smtp.sendmail(sender, recipient, msg.as_string()) | |
smtp.quit() | |
if __name__ == '__main__': | |
# Set the sender, recipient, subject, and message | |
sender = '[email protected]' | |
recipient = '[email protected]' | |
subject = 'Daily Email' | |
message = 'This is a daily email.' | |
# Send the email | |
send_email(sender, recipient, subject, message) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment