My program gets images from the r/memes subreddit. I am trying to figure out how to send the urls of those memes to my iphone via smtplib. I have run intothe error of the text message being blank. Here is my code:
import praw
import praw, requests
import smtplib
import time
reddit = praw.Reddit(client_id='________',
client_secret='______',
user_agent='____',
username="____",
password="_____")
for submission in reddit.subreddit("memes").stream.submissions(skip_existing=True):
server = smtplib.SMTP_SSL('smtp.gmail.com', 465)
server.login('________', '________')
time.sleep(1)
server.sendmail('________', '_______', str(submission.url))
server.quit()
time.sleep(1800)
pass
Is this because the url has special characters?, I have tried twilio, but I would like to run this script on python anywhere to keep it active. Thank You!
Ps: I operate on Python3, MacOS.
Try doing this "\n\n\n" + str(submission.url)
, since sometimes the messages gets mistaken as a part of the header, not the body.