Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import smtplib
- import datetime
- loginUrl = 'http://uren.rickvanfessem.nl:3000/users/login'
- username = 'Admin'
- password = ''
- token = ''
- sentFrom = 'noreply@rickvanfessem.nl'
- mailUser = "noreply@rickvanfessem.nl"
- mailPassword = ''
- mailDest = ['rickvanfessem@gmail.com']
- sendToCol = False
- sendToThomas = True
- subject = 'Test'
- body = """
- Test
- """
- message = """
- To: %s
- Subject: %s
- %s
- """ % (", ".join(mailDest), subject, body)
- def main():
- today = datetime.date.today()
- if (today.day == 1 and sendToThomas):
- sendMail(message)
- def sendMail(message):
- try:
- server = smtplib.SMTP('send.one.com', 587)
- server.ehlo()
- server.starttls()
- server.login(mailUser, mailPassword)
- server.sendmail(sentFrom, mailDest, message)
- server.close()
- except smtplib.SMTPException as e:
- print (e)
- except smtplib.SMTPServerDisconnected as e:
- print (e)
- if __name__ == '__main__':
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement