Skip to content

Instantly share code, notes, and snippets.

@gwire
Last active October 19, 2018 09:27
Show Gist options
  • Save gwire/64cb546a9635120f2535bdb154361d5f to your computer and use it in GitHub Desktop.
Save gwire/64cb546a9635120f2535bdb154361d5f to your computer and use it in GitHub Desktop.
Simple email notifications in Slack
require ["enotify", "variables"];
if header :contains ["Subject"] ["Urgent","Emergency","You done goofed"] {
if header :matches "Subject" "*" { set "subject" "${1}"; }
if header :matches "From" "*" { set "from" "${1}"; }
notify :importance "3" :from "New message notification <test@example.com>" :message "${from}: ${subject}" "mailto:0xdeadbeef@example.slack.com";
}
@gwire
Copy link
Author

gwire commented Sep 12, 2017

Although, while most appear in a timely fashion I've seen one where the time between being accepted by the remote mailserver and appearing in the channel was a couple of hours. So don't necessarily rely on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment