Skip to content

Instantly share code, notes, and snippets.

@ajsya
Created June 8, 2023 01:52
Show Gist options
  • Save ajsya/8b4ef0b6611b670d6ffd361a4f8b094b to your computer and use it in GitHub Desktop.
Save ajsya/8b4ef0b6611b670d6ffd361a4f8b094b to your computer and use it in GitHub Desktop.
Google Bard Wrote This
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