GithubHelp home page GithubHelp logo

email2pb's Introduction

Email 2 PushBullet

Email to PushBullet notification

This simple script allows to redirect mail input(from postfix, for example) from a certain mail address to PushBullet notification. Useful to send pushes from sources which are able to send email only.

Example usage

Lets imagine that we want to redirect all emails sent to [email protected] to your PushBullet account(and therefore to your mobile devices, browser excensions, etc) Keep in mind that instructions below were tested on Debian 6 with python 2.6 So, thats what you should do:

Step zero: setup and configure postfix for domain example.com and other prerequisites

Bla-bla-bla

Step 1: create shell script

First, create shell script which will contain email2pb call and an API key. If you will directly specify python script with a API key in aliases file - this'll be a major security hole. So our script will be something like this:

#!/bin/sh
/usr/bin/python /var/spool/postfix/email2pb/email2pb.py --key YOUR_PUSHBULLET_API_KEY

Let's name it...umm... /var/spool/postfix/email2pb/email2pb And make it executable:

chmod +x /var/spool/postfix/email2pb/email2pb

Why there? My example was tested in Debian, and postfix's home dir on Debian 6 is /var/spool/postfix Rememer, postfix should be able to acces your script.

Step 2: add mail alias

Open /etc/aliases file and append a line there:

push: |/var/spool/postfix/email2pb/email2pb

Save the file and execute newaliases command.

Step 3: test it

Send email to [email protected] and, if it didn't work, check /var/log/mail.log

Thats it.

email2pb's People

Contributors

side2k avatar yepoleb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

email2pb's Issues

TypeError: decode() argument 1 must be string, not None

I'm using postfix 2.11.0 on Ubuntu 14.04

Here's the mail.log:

Jun  8 13:50:25 chewbacca postfix/pickup[30280]: 5A8582540B68: uid=0 from=<[email protected]>
Jun  8 13:50:25 chewbacca postfix/cleanup[32233]: 5A8582540B68: message-id=<[email protected]>
Jun  8 13:50:25 chewbacca postfix/qmgr[5290]: 5A8582540B68: from=<[email protected]>, size=361, nrcpt=1 (queue active)
Jun  8 13:50:25 chewbacca postfix/local[32234]: 5A8582540B68: to=<[email protected]>, relay=local, delay=0.15, delays=0/0/0/0.15, dsn=5.3.0, status=bounced (Command died with status 1: "/var/spool/postfix/email2pb/email2pb". Command output: Traceback (most recent call last):   File "/var/spool/postfix/email2pb/email2pb.py", line 50, in <module>     body_part = body_part.decode(part.get_content_charset()) TypeError: decode() argument 1 must be string, not None )
Jun  8 13:50:25 chewbacca postfix/cleanup[32233]: 7FEEF2540B90: message-id=<[email protected]>
Jun  8 13:50:25 chewbacca postfix/bounce[32237]: 5A8582540B68: sender non-delivery notification: 7FEEF2540B90
Jun  8 13:50:25 chewbacca postfix/qmgr[5290]: 7FEEF2540B90: from=<>, size=2676, nrcpt=1 (queue active)
Jun  8 13:50:25 chewbacca postfix/qmgr[5290]: 5A8582540B68: removed
Jun  8 13:50:25 chewbacca postfix/cleanup[32233]: 80DF025400F6: message-id=<[email protected]>
Jun  8 13:50:25 chewbacca postfix/qmgr[5290]: 80DF025400F6: from=<>, size=2818, nrcpt=1 (queue active)
Jun  8 13:50:25 chewbacca postfix/local[32234]: 7FEEF2540B90: to=<[email protected]>, relay=local, delay=0.01, delays=0/0/0/0, dsn=2.0.0, status=sent (forwarded as 80DF025400F6)
Jun  8 13:50:25 chewbacca postfix/qmgr[5290]: 7FEEF2540B90: removed
Jun  8 13:50:25 chewbacca dovecot: lda([email protected]): msgid=<[email protected]>: saved mail to INBOX
Jun  8 13:50:25 chewbacca postfix/pipe[32238]: 80DF025400F6: to=<[email protected]>, orig_to=<[email protected]>, relay=dovecot, delay=0.03, delays=0/0/0/0.02, dsn=2.0.0, status=sent (delivered via dovecot service)
Jun  8 13:50:25 chewbacca postfix/qmgr[5290]: 80DF025400F6: removed

I'm not familiar with Python programming so I don't know about a workaround for this.

Any ideas?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.