Skip to content

Instantly share code, notes, and snippets.

@mattbk
mattbk / start_mail_ip.py
Last active February 20, 2016 23:04 — forked from johnantoni/startup_mailer.py
Raspberry Pi - Send email with public IP address (will need Gmail account to send from. Need to allow less secure apps at Gmail, see http://naelshiab.com/tutorial-send-email-python/).
# https://gist.github.com/johnantoni/8199088
import subprocess
import smtplib
import socket
from email.mime.text import MIMEText
import datetime
# Change to your own account information
to = 'TO@gmail.com'
gmail_user = 'YOU@gmail.com'
gmail_password = 'PASSWORD'