mborsetti / webchanges

webchanges anonymously checks web content (including images) and commands for changes, delivering instant notifications and AI-powered summaries to your favorite platform.
https://pypi.org/project/webchanges/
Other
37 stars 6 forks source link

[BUG] stmp setting has problem, email cannot forward email #19

Closed A6669 closed 3 years ago

A6669 commented 3 years ago

Describe the bug

Traceback (most recent call last): File "/Users/xxx/opt/anaconda3/bin/webchanges", line 8, in sys.exit(main()) File "/Users/xxx/opt/anaconda3/lib/python3.8/site-packages/webchanges/cli.py", line 230, in main urlwatch_command.run() File "/Users/xxxx/opt/anaconda3/lib/python3.8/site-packages/webchanges/command.py", line 597, in run self.urlwatcher.close() File "/Users/xxx/opt/anaconda3/lib/python3.8/site-packages/webchanges/main.py", line 125, in close self.report.finish(jobs_file=self.jobs_storage.filename) File "/Users/xxx/opt/anaconda3/lib/python3.8/site-packages/webchanges/handler.py", line 377, in finish ReporterBase.submit_all(self, self.job_states, duration, jobs_file) File "/Users/xxx/opt/anaconda3/lib/python3.8/site-packages/webchanges/reporters.py", line 213, in submit_all subclass(report, cfg, job_states, duration, jobs_file).submit() File "/Users/xxx/opt/anaconda3/lib/python3.8/site-packages/webchanges/reporters.py", line 917, in submit mailer.send(msg) File "/Users/xxx/opt/anaconda3/lib/python3.8/site-packages/webchanges/mailer.py", line 99, in send with smtplib.SMTP(self.smtp_server, self.smtp_port) as server: File "/Users/xxx/opt/anaconda3/lib/python3.8/smtplib.py", line 253, in init (code, msg) = self.connect(host, port) File "/Users/xxx/opt/anaconda3/lib/python3.8/smtplib.py", line 339, in connect (code, msg) = self.getreply() File "/Users/xxx/opt/anaconda3/lib/python3.8/smtplib.py", line 396, in getreply raise SMTPServerDisconnected("Connection unexpectedly closed") smtplib.SMTPServerDisconnected: Connection unexpectedly closed

To Reproduce Include relevant snippets of anything required (e.g. jobs and configuration files) for anyone to fully reproduce the bug.

display: error: true new: true unchanged: false job_defaults: all: {} browser: {} shell: {} url: {} report: email: enabled: ture from: 'aaa@126.com' html: ture method: smtp sendmail: path: sendmail smtp: auth: true host: smtp.126.com port: 25 starttls: true user: 'aaa@126.com' insecure_password: xxxxx' subject: '{count} changes: {jobs}' to: 'bbb@gmail.com' html: diff: unified mailgun: api_key: '' domain: '' enabled: false from_mail: '' from_name: '' region: us subject: '{count} changes: {jobs}' to: '' markdown: details: true footer: true minimal: false matrix: access_token: '' enabled: false homeserver: '' room_id: '' pushbullet: api_key: '' enabled: false pushover: app: '' device: null enabled: false sound: spacealarm user: '' slack: enabled: false webhook_url: '' stdout: color: true enabled: true telegram: bot_token: '' chat_id: '' enabled: false text: details: true footer: true line_length: 75 minimal: false

Expected behavior A clear and concise description of what you expected to happen. webchange should send my email to my 126 mail to my gmail Screen scrape/screenshots If applicable, add screen scrape or screenshots to help explain your problem.

Version info Please run webchanges -v and paste the version information as follows (first 3 lines): -2021-11-03 09:17:52,314 cli DEBUG: webchanges: 3.8.3 Copyright 2020- Mike Borsetti -2021-11-03 09:17:52,315 cli DEBUG: CPython: 3.8.8 ('default', 'Apr 13 2021 12:59:45') Clang 10.0.0 -2021-11-03 09:17:52,348 cli DEBUG: System: macOS-10.16-x86_64-i386-64bit

Additional context Add any other context about the problem here. I use a software called launchcontrol link to auto run webchange at night. this is launchcontrol's setting up. image image

and this bug is a little bit strange, sometimes webchange does work, sometimes it will produce errors as above. can you help me? thanks in advance.

mborsetti commented 3 years ago

Thanks for a complete report, but I am afraid this is most likely a server-side error. In any case the last call from webchanges is to the built-in Python library smtplib, so there isn't much I can do about it as it is this built-in library that ultimately reports "Connection unexpectedly closed" with your server:

File "/Users/xxx/opt/anaconda3/lib/python3.8/site-packages/webchanges/mailer.py", line 99, in send
with smtplib.SMTP(self.smtp_server, self.smtp_port) as server:

Of course, using another server might do the trick (I use Gmail and have never seen this error).