Skip to main content

THE EMAİL WATCHER

The IMAP gmail watcher.Follow your emails and when email comes play mp3 alarm.. Also you can see the your ip to right corner. And you can see your last 10 emails on your screen.Then i have just setup on raspberry pi 1 2011(b) :]] Do you now why. I will talk abaut it problems part....

--HOW CAN YOU USE İT : I wrote the auto startup script so when you enable it its automaticly run.When it open it will ask you tu ypur gmail and app password. I will talk abaut that later.


AND TO SETUP ALL CODE --- https://github.com/mercan798/IMAP-GMA-L-PROJECT/blob/main/gmail-watcher.service

--WHAT TECHS I USE WHİLE I WROTE İT? : imaplib(for gmails) ,Tuı(frontend) ,pygame(for alarm) The question on yur mind " why pygame" i now ı can use the playsound, yes i will change it , mybe i alredy did.

--GMAİL APP PASSWORD:

If login fails with "Invalid credentials", you need a Gmail App Password:

Go to your Google Account security settings Enable 2-Step Verification if not already enabled Generate an App Password for Mail Use that 16-character password in the login screen

--DATA STORAGE:

The app stores credentials in credentials.json in the project root Last seen email UID is stored in watcher_state.json to track new emails Credentials are deleted when you log out

THE PROBLEMS WHİLE İ AM WROTE THE PROJECT:

FİRST "THE RARSPBERRY Pİ": Okey unfortunatly i was set up this project 3 times and 3 diffrent pc's. Why?

firs pi3 model b+ i set it but 3 hours later, the card holder is broken then i have to change same pi3, and then it was not opened at all ,because it wasnt take electric his CPU ,i understod that from the lights, its never turn green light even when boot cart wasnt plug. Okey then i decited to set up pi 1 that i talk abaut. And pi 1 was not coming with the soundcard , wifi ,bluethot. Then we buy for customer. Okey the setup was solved... Lets talk abaut the code problems...

SECOND THE MEMORY: What was the problem?

When the program started for the first time, last_uid was empty (None).

So this line:

became:

5842 != None → True

The program thought the last email was a new email.

So it triggered alarm for old mails.

Which code fixed it?

This code:

What does this code do?

When program runs first time, it takes the current latest email UID, saves it as reference, does not trigger alarm..

this is how i build this program and of course this in not the all problems just the ones to worth it to highlight.