Skip to content
Send the local ip address of your Raspberry Pi via email
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Send the local ip address of your Raspberry Pi via email


When you connect your Raspberry Pi to a network with DHCP, it is sometimes hard to find out the IP of the Pi. Ways to solve this include:

  • Connect a screen/keyboard and look up via 'ifconfig'
  • Look at the DHCP IP assignment table of the router
  • Set a static IP at the Pi
  • Tunnel the Pi through another computer
  • Try out all possible IPs
  • Have the Pi tell you it's IP ...

This script here is the last solution. On boot it will look if the Pi has an IP and send it to you via mail. Boom, you are in!

The repository lives at


Clone the repository

cd ~
git clone git://
cd findmypi

Copy and change the settings file


You can enter your own smtp server. The default is using Gmail.

Please note that your email password will be in the settings in plain text. If your RaspberryPi gets stolen, the attacker might gain access to your whole email account. The safest way is to create a dedicated email account. If you use Gmail, you can also use an 'application specific password'.

Once this is done, check if it works locally:


# check your email inbox for the email

You will probably want to have this script be executed on startup

sudo nano /etc/rc.local

# add to the bottom just before 'exit 0'
python /home/pi/findmypi/ &

Restart your Pi and wait for the email


The code was initially created by Alex on Big ups for the work! I only forked and extended it ...

You can’t perform that action at this time.