|
Have you ever wanted to automate email? The code below will show you how. This could be used to automate an email notification based on an attribute in a feature class, for example, if you have a traffic accident that is classified as "fatal", you could plug this code into a search cursor on your accidents features and automate an email to whoever is concerned with serious traffic accidents.
#name: playingWemail.py #date: 20070213 #author: Kevin Bell, stealing from Justin Johnson, who was stealing from...? #email:
This e-mail address is being protected from spam bots, you need JavaScript enabled to view it
#phone: (801) 535-7131 #purpose: send some email. import smtplib server = "999.99.99.99" #address of SMTP server fromaddr = "python!" #email address of sender toaddr = "
This e-mail address is being protected from spam bots, you need JavaScript enabled to view it
" #email address of recipient message = """To: %s From: %s Subject: Test Message Hello, This is a test message from smtplib.""" % (toaddr, fromaddr) s = smtplib.SMTP(server) s.sendmail(fromaddr, toaddr, message) |