Skip to content

Commit

Permalink
Merge pull request #14 from byby221b/feature/baiy
Browse files Browse the repository at this point in the history
FIX smtp error
  • Loading branch information
TideDra authored Dec 1, 2024
2 parents da97c59 + dd7ed3b commit b64d2fe
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,12 @@ def _format_addr(s):
today = datetime.datetime.now().strftime('%Y/%m/%d')
msg['Subject'] = Header(f'Daily arXiv {today}', 'utf-8').encode()

if smtp_server == 'smtp.qq.com':
server = smtplib.SMTP_SSL(smtp_server, smtp_port)
else:
try:
server = smtplib.SMTP(smtp_server, smtp_port)
server.starttls()
except smtplib.SMTPServerDisconnected:
server = smtplib.SMTP_SSL(smtp_server, smtp_port)

server.login(sender, password)
server.sendmail(sender, [receiver], msg.as_string())
server.quit()
Expand Down

0 comments on commit b64d2fe

Please sign in to comment.