Fixed Mails showning in SPAM
This commit is contained in:
parent
18267f1f63
commit
09b47a2ec0
17
lainchan.py
17
lainchan.py
|
@ -13,8 +13,8 @@ import smtplib
|
|||
import getpass
|
||||
from datetime import datetime
|
||||
|
||||
EMAIL_SOURCE = 'sender_email_id_goes_here'
|
||||
EMAIL_TARGET = 'target_email_id_goes_here'
|
||||
EMAIL_SOURCE = 'mananapr@gmail.com'
|
||||
EMAIL_TARGET = 'ms704@snu.edu.in'
|
||||
PASS = getpass.getpass("Enter Password for %s: " %(EMAIL_SOURCE))
|
||||
|
||||
# Function to send URL of thread in mail to EMAIL_TARGET
|
||||
|
@ -23,14 +23,19 @@ def send_mail(url, diff):
|
|||
server.ehlo()
|
||||
server.starttls()
|
||||
server.login(EMAIL_SOURCE, PASS)
|
||||
msg = str(diff) + ' new replies at ' + url
|
||||
msg = "\r\n".join([
|
||||
"From: " + EMAIL_SOURCE,
|
||||
"To: " + EMAIL_TARGET,
|
||||
"Subject: New Messages at Lainchan",
|
||||
"",
|
||||
str(diff) + " new post(s) at " + str(url)
|
||||
])
|
||||
server.sendmail(EMAIL_SOURCE, EMAIL_TARGET, msg)
|
||||
server.quit()
|
||||
|
||||
# Dictionary of URLs to watch for with their posts count.
|
||||
urls = {
|
||||
'https://lainchan.org/lam/res/22622.html' : 0,
|
||||
'https://lainchan.org/lam/res/21073.html' : 0,
|
||||
'https://lainchan.org/tech/res/35471.html' : 0,
|
||||
'https://lainchan.org/lam/res/17682.html' : 0
|
||||
}
|
||||
|
||||
|
@ -67,7 +72,7 @@ while True:
|
|||
if count > c :
|
||||
diff = count - c;
|
||||
print("\n%d new post(s)" %(diff))
|
||||
print("Sending Mail...")
|
||||
print("Sending Mail...\n")
|
||||
urls[url] = count
|
||||
send_mail(url, diff)
|
||||
|
||||
|
|
Loading…
Reference in New Issue