Project in progress
Gmail Notifier

Gmail Notifier © GPL3+

A small program for receiving visual notification of a Gmail message.

  • 807 views
  • 0 comments
  • 5 respects

Components and supplies

Apps and online services

About this project

I love notifiers.

A very long time ago, I ordered a "gadget" from one of the Chinese stores. It had to use a PC program to flash with a colorful LED, checking mail accounts via the pop protocol.

Now, the functionality of this gadget is not relevant with the new security formats, but I have Arduino, Google and free time.


Code

Arduino Arduino
Code that monitors the usb port for arduino
int outPin = 2; // Output connected to digital pin 12
int mail = LOW; // Is there new mail?
int val; // Value read from the serial port

void setup()
{
    pinMode(outPin, OUTPUT); // sets the digital pin as output
    Serial.begin(115200);
//    Serial.flush();*/
}


void loop()
{
    // Read from serial port
    if (Serial.available())
    {
        val = Serial.read();
        Serial.println(val);
        if (val == 1) mail = HIGH;
        else if (val == 0) mail = LOW;
    }

    // Set the status of the output pin
    digitalWrite(outPin, mail);
}
PC gmail checkerPython
The code for windows sheduler which checks for the presence of mail and sends data to the usb port for arduino.
Using 2-Step-Verification of Google and creating an application password.
import time, serial, sys
from imapclient import IMAPClient

HOSTNAME = 'imap.gmail.com'
MAILBOX = 'Inbox'
USERNAME = '_YOU_GMAIL_'
PORT = '_YOU_COMPORT_'
PASSWORD = '_YOU_APP_PASS_FROM_GOOGLE_'
NEWMAIL_OFFSET = 20

server = IMAPClient(HOSTNAME, use_uid=True, ssl=True)
server.login(USERNAME, PASSWORD)

unseen = server.folder_status(MAILBOX, ['UNSEEN'])
newmail_count = (unseen[b'UNSEEN'])
ser = serial.Serial(PORT, 115200, timeout=0)
time.sleep(1.5)

if newmail_count > NEWMAIL_OFFSET:
 ser.write(bytes([1]))
 time.sleep(0.5)
else:
 ser.write(bytes([0]))
 time.sleep(0.5)

server.logout()
ser.close()

Comments

Author

Realrlmf
Realrlmf
  • 1 project
  • 0 followers

Additional contributors

Published on

December 3, 2019

Members who respect this project

DefaultTarantula3Default

and 2 others

See similar projects
you might like

Similar projects you might like

Door Knock Notifier

by Random Science Stuff

  • 3,734 views
  • 1 comment
  • 14 respects

Gmail & Arduino UNO & IPv6

by phpoc_man

  • 3,086 views
  • 0 comments
  • 17 respects

Send An Email From Your Gmail Account With Temboo

Project tutorial by Temboo_OFFICIAL

  • 1,647 views
  • 0 comments
  • 2 respects

Arduino Gmail Clock

Project tutorial by fmattiussi

  • 879 views
  • 1 comment
  • 1 respect

Message Box Influence for Non-Disabled

Project in progress by 5 developers

  • 1,525 views
  • 0 comments
  • 8 respects

Bluetooth Nerf Turret

Project tutorial by Little_french_kev

  • 15,293 views
  • 27 comments
  • 169 respects
Add projectSign up / Login