Download as odg, pdf, or txt
Download as odg, pdf, or txt
You are on page 1of 1

WEEK 4

Aim:To send an email when an accident is detected


Description: The rapid rise of technology and infrastructure has made our lives easier. The high demand of
automobiles has also increased the traffic hazards and road accidents. Life of the people is under high risk.
The delay in reaching of the ambulance to the accident location and the traffic congestion in between
accident location and hospital increases the chances of death of the victim. To overcome this problem our
automatic ambulance rescue system comes to the rescue. This proposed IOT based accident detection system
helps to reduce the loss of life due to accidents and also sends an email to the emergency contact.
Source Code:
import smtplib
s=smtplib.SMTP('smtp.gmail.com',587)
smtpUser='iotlab1234@gmail.com'
smtpPass='lablab1234'
toAdd='samhithakammachavala@gmail.com'
fromAdd=smtpUser
subject='testing mail'
header='To: ' + toAdd + '\n' 'From:' + fromAdd + '\n\n' + subject
body='from within python script'
print(header + '\n' + body)
s=smtplib.SMTP('smtp.gmail.com',587)
s.ehlo()
s.starttls()
s.ehlo()
s.login(smtpUser,smtpPass)
s.sendmail(fromAdd,toAdd, header + '\n' +body)
s.quit()

Output:

You might also like