Python Forum
send email after restart raspberry pi
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
send email after restart raspberry pi
#6
(Jun-06-2019, 02:04 PM)chano Wrote: i cant to install emails
What'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 this
But 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
Reply


Messages In This Thread
send email after restart raspberry pi - by chano - Jun-05-2019, 09:48 AM
RE: send email after restart raspberry pi - by snippsat - Jun-06-2019, 06:20 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Virtualenv with auto restart JohnnyCoffee 3 2,960 Apr-27-2021, 05:27 AM
Last Post: ndc85430

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020