I wrote a python script that checks a website and eventually sends an email. I copied the script to my raspberry and when I execute it via ssh it works fine. But when I let it execute by the crontab it doesn't. In the syslog I can see that the script was executed but I get these errors:
Apr 2 14:25:01 raspberrypi CRON[28850]: (pi) CMD (sudo /usr/bin/python3 /home/pi/Desktop/Script/main.py >> /home/pi/Desktop/Script/log.txt)
Apr 2 14:25:04 raspberrypi sSMTP[28854]: Unable to connect to "smtp.cablelink.at" port 587.
Apr 2 14:25:04 raspberrypi sSMTP[28854]: Cannot open smtp.cablelink.at:587
Apr 2 14:25:04 raspberrypi cron[430]: sendmail: Cannot open smtp.cablelink.at:587
Apr 2 14:25:04 raspberrypi CRON[28849]: (pi) MAIL (mailed 220 bytes of output but got status 0x0001 from MTA#012)
The crontab entry looks like this:
* * * * * /usr/bin/python3 /home/pi/Desktop/Scrabber/main.py >> /home/pi/Desktop/Scrabber/log.txt
I think it's not a problem of permission because for all i can see the crontab is executed as user pi as well as when I use the ssh command.
Thanks in advance.