(Jun-06-2019, 02:04 PM)chano Wrote: i cant to install emailsWhat's the error?
Example working:
λ pip install emails Collecting emails Downloading 0.5.15-py2.py3-none-any.whl (57kB) |████████████████████████████████| 61kB 245kB/s ............ Installing collected packages: cssutils, cachetools, premailer, emails Successfully installed cachetools-3.1.1 cssutils-1.0.2 emails-0.5.15 premailer-3.4.1
chano Wrote:i have smtplib if can with thisBut do you have a SMTP service provider?
If have then the simplest way.
# my_email.py import smtplib def send_mail(): server = smtplib.SMTP() server.connect('smtp.host.adress') server.sendmail('[email protected]', '[email protected]', 'Subject: Camera down') print("Mail sent successfully") server.quit() send_mail()
chano Wrote:How raspberry send email when it restarting, I want receive email when raspberry is restarting,Usage of Cron,run script on reboot.
sudo crontab -e
Add:
@reboot python /home/pi/MyProgram/my_email.py &Restart
sudo reboot