Skip to content

4oo4/email2gotify

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 

Repository files navigation

Email 2 Gotify

Email to Gotify notification

A fork of email2pb

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

Example usage

Let's imagine that we want to redirect all emails sent to push@example.com to your Gotify account (and therefore to your mobile devices). These instructions below were tested on Debian 11, Python 3.9. Requires pycurl (apt-get install python3-pycurl python2-htm2text or python3 -m pip install pycurl html2text)

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 email2gotify 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/python3 /var/spool/postfix/email2gotify/email2gotify.py --key YOUR_GOTIFY_TOKEN --url YOUR_GOTIFY_ROOT_URL

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

chmod +x /var/spool/postfix/email2gotify/email2gotify

Why there? My example was tested in Debian, and postfix's home dir on Ubuntu is /var/spool/postfix Remember, 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/email2gotify/email2gotify

Save the file and execute newaliases command.

Step 3: test it

Send email to push@example.com and, if it didn't work, check /var/log/mail.log

Thats it.

About

Email to Goitfy notifications

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%