You've Got Mail

So this has turned out to be a fun weekend experiement using my newly purchased Raspberry Pi and Node.js.

The Idea

So during a cycle home from +rehabstudios on Friday, I had an idea where I could use my Raspberry Pi as an announcer for new email to my account. You know something like what AOL had (http://www.youtube.com/watch?v=wB8xPnhpzAM), but I figured I could extend it to the latest technologies. Esentially it will read aloud any new emails I recieve to a specified address.

Exectuction

In your terminal application navigate to your project then run the following.

npm install mail-notifier
npm install say

Then in your project app.js file add the following lines of code and change the options in the imap object to your mail server.

var notifier = require('mail-notifier'),
say = require('say');

var imap = {
  username: "mail@example.com",
  password: "password",
  host: "imap.example.com",
  port: 993, // imap port
  secure: true // use secure connection
};

notifier(imap).on('mail',function(mail){
    say.speak('Alex', 'You\'ve got mail', function(){
        setTimeout(function(){
            say.speak('Alex', 'From: '+mail.from[0].name, function(){
                setTimeout(function(){
                    say.speak('Alex', mail.text);
                },600);
            });
        },800);
    });
}).start();

Now run your application using node app.js. Any email that you send to your listed email will be alerted and read aloud. Enjoy and explore the endless possibilites.

This article is my 1st oldest. It is 202 words long, and it’s got 0 comments for now. Next article »