The very first thing we will do is to create a new Gmail account.
So we have a dedicated email address we can use to send emails from the Raspberry Pi.
Okay.
So this email address will be the sender email.
And here maybe you think you could use your personal email address.
That would work.
Yes.
But for security reasons I would recommend not to do that.
And it's also going to be much easier to manage things with a dedicated email address.
So what you can do is open a web browser.
You can do that from the Raspberry Pi directly.
As you can see, that's what I did here.
But you can just open any web browser from any operating system is the same and just go to google.com.
And here you can just click on sign in for example.
And because well, I'm signed out of this account.
But let's say that we create a new account.
So you can here you can click on Create account.
So you should see something like that for example for personal use.
And well for example you can name it Raspberry Pi.
Verify you can choose the name you want here.
Doesn't matter.
Click on next.
Then you make sure that you give a birthdate as well, at least 18 years old.
So for example, whatever, just choose whatever.
Next.
Um, okay.
And here.
Well, if they ask you this question, you're going to create a Gmail address.
That's the one we want to use with the Google account.
Click on next.
So you choose an email address.
So the one I'm going to use for example is course dot Raspberry Pi.
So this one is already taken.
That's the one I created.
Just to give you an inspiration.
If you want to create something similar.
So you create an email address here.
You click on next.
Then they're going to ask you for a password.
You finish the configuration okay.
Maybe you need to validate your account with a phone number.
So you do that.
You may also want to add a recovery email a recovery phone.
Well, you can just configure your account and I'm going to come back to this.
But it's also important that you activate the two step verification.
So if Google asks you do you want to do the two step verification.
You click on.
Yes.
Because that's going to be a mandatory step for the following.
All right.
And once you have created the account you just log in and let's do the configuration so that we can
send emails from the Raspberry Pi.
And once you are connected.
So here I'm back to the Google page.
You can you can just click on your account go to settings.
And there are different ways to do that.
So here I click on those dots I click on my account and I go to the account settings.
And to be able to send an email from the Raspberry Pi, we will need to create what's called an app
password.
Okay.
So that you can use the email address here.
This email address was created from an external application.
And external application is going to be our Python script.
And before we do this where you go to security here.
And you have a two step verification.
So you see for me it's.
Activated.
So make sure that you activate the two step verification here.
That's going to be mandatory for what we need to do right now.
And so how to create an app password.
So the thing is this Google menu, this Google account menu and all the whole interface is changing
quite frequently.
So somehow recently they removed the link to the app password.
So you cannot really find it from anywhere.
So what you have to do is to go on this search bar here and type exactly app space passwords with an
S.
And you see we have the app passwords here.
You type this, you click here and you will get two.
All right we need to verify the phone first.
So I'm going to do that okay.
So I have verified my phone again.
And you will get to this app passwords page.
And you can see the URL is my myaccount.google.com slash app passwords.
The rest doesn't matter.
You can just type this exactly, and you should also get to this menu.
So to send an email from the Raspberry Pi we will use the the well the email address we have created
here and also a password.
But that's not going to be the password of the Google account.
That's going to be an app password that we create here.
So for example you can let's do a test create.
And you see we have a new generated app password.
So this is the password that you can use in your code.
Now I can click on done.
And you can see I have my app password.
The thing is if you didn't note this, if you didn't copy this password somewhere and if you don't remember
it well, you cannot get it again, that's not the problem.
You just create a new one.
Okay.
You can remove that one as well.
So that's really not a problem.
So let's create one for example Raspberry Pi email okay I create one.
And what I'm going to do right now is to save this inside a file.
So I could use the graphical interface, but let's use the terminal.
Okay.
Since we know how to use it, you open a terminal.
I am in my home directory.
Make sure that its home directory with CD.
And then well, we're going to properly store the password later on in this section.
But for now let's just create a file with nano and let's name it temp okay.
For temporary file.
Usually I do this if I know I'm going to use a file just for temporary moment, I name it temp for example.
It doesn't really matter.
And we are going to copy this.
So I'm going to select control C and then how to actually paste how to copy and paste something from
the terminal.
Because if you do Ctrl V or Ctrl C it's not going to work.
You have to do Ctrl shift.
So here Ctrl shift and V and you see the text has been copied, then I'm going to do Ctrl S and Ctrl
X okay.
So I have my password here.
And we're going to use this file later in this section.
So to recap here you create a new Google account for your Raspberry Pi.
You activate the two step verification.
Then you go to the app passwords.
You generate a new password that you copy somewhere.
So anywhere it doesn't matter.
You can even write it on a piece of paper.
You just copy it and we're going to use that later in the course.
And very important note is that when I refer to the password that we use in the code, once again it's
not the password of your Google account, it's the password here, the app password that we have generated.
Okay.
We will never use the password of your Google account.
Okay.
Never write this anywhere on your Raspberry Pi.
Just use the app passwords that you have generated here, and you can generate as many app passwords
as you want for as many applications as you want.