Advertisement
epheterson

Diary of Earth

Aug 8th, 2013
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.86 KB | None | 0 0
  1. import praw
  2. import smtplib
  3. import string
  4. import time
  5. import datetime
  6. today = datetime.date.today()
  7.  
  8. r=praw.Reddit(user_agent='DiaryOfEarth');
  9. r.login('USERNAME','PASSWORD')
  10. r.submit('DiaryOfEarth',today.strftime("%B %d, %Y"), text="Thread started by the DiaryOfEarth robot.\n\nShare your thoughts.");
  11.  
  12. SUBJECT = "Diary of Earth, %s days in!" % today.strftime("%j")
  13. text = "Another successful job, thanks to automation.";
  14. BODY = string.join((
  15.         "From: Diary of Earth Robot <[email protected]>",
  16.         "To: Mr. Pheterson <[email protected]>",
  17.         "Subject: %s" % SUBJECT ,
  18.         "",
  19.         text
  20.         ), "\r\n")
  21. server = smtplib.SMTP("smtp.gmail.com", 587)
  22. server.ehlo()
  23. server.starttls()
  24. server.ehlo()
  25. server.login("[email protected]", "PASSWORD)(*&^%$#@!")
  26. server.sendmail("[email protected]", ["[email protected]"], BODY)
  27. server.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement