Automatically emailing my Raspberry Pi IP address on start up

Posted: April 20, 2014 by schoolpiclub in General News

I connect to my Raspberry Pi via VNC quite a lot, this was the reason I wanted to set up my Raspberry Pi to email my IP address automatically on start up.

I’ve tried before but couldn’t get it to work but today I found a different python script which worked first time. Here is how I set it up.

1. Create a python script and store it in a Directory.

I created a script and called it ‘‘ . Click the following link to view the code I used. Please note you will need to enter your email account settings where necessary, I use a gmail account.

I stored it in a directory and named it ‘Code

2. Make the python script executable.

To do this type the following command in terminal ‘sudo chmod +x

3. I now needed to add a line of code to my boot file. I use Raspbian so to access the boot file I typed in the following command ‘sudo nano /etc/rc.local

At the end of the code enter the location of your ‘’ file mine was ‘python /home/pi/Code/’. Save the changes.

Click the following link rc.local to see what your code should look like once you’ve added that line.

4. Now reboot your Raspberry Pi and you should automatically receive an email containing you Raspberry Pi’s IP address.


Comments are closed.