🔒 Closed Auto sending email

Status
Not open for further replies.
Code:
import smtplib
import datetime

now = datetime.datetime.now().strftime("%H:%M:%S")
weekday = datetime.datetime.today()

def send_email(subject, msg):
 try:
  if weekday == 0 or weekday == 3:
   server = smtplib.SMTP('smtp.gmail.com:587')
   server.ehlo()
   server.starttls()
   server.login(email_add, password)
   message = 'Subject: {}\n\n{}'.format(subject,msg)
   server.sendmail(email_add,email_add,message)
   server.quit()
   print("Success: Email sent!")
 except:
   print("Email failed to send")

subject = "Test email!"
msg = "Hello there ! this is python"

email_add = ""
password = ""

send_email(subject, msg)


Gusto ko po kasi mag send tong script ng email sa sinet kung date pero wala akong natatanggap.
 
Status
Not open for further replies.

Similar threads

About this Thread

  • 3
    Replies
  • 587
    Views
  • 2
    Participants
Last reply from:
Heizengberg

Trending Topics

Online now

Members online
1,348
Guests online
3,553
Total visitors
4,901

Forum statistics

Threads
2,306,371
Posts
29,171,248
Members
1,194,777
Latest member
beau
Back
Top