You are not logged in.
Hello, could you please help me with my maildrop notifications?
i user procmail + maildrop + mutt combo and it worked great on debain, i moved my configs to arch(got back to arch after few months on deb)
the thing is i need .mailfilter to call mail-notify script that uses notify-send to notify me about new mails.
.mailfilter part:
...
`/home/user/bin/mail-notify`
to $INBOX/home/user/bin/mail-notify:
#!/bin/bash
while read line
do
echo $line
if [ $(echo $line | grep -Ec "^Subject: ") -eq 1 ]
then
subject=$(echo $line | sed -r 's/^Subject: //')
fi
if [ $(echo $line | grep -Ec "^From: ") -eq 1 ]
then
from=$(echo $line | sed -r 's/^From: //')
fi
done
fromname=$(echo $from | cut -d"<" -f1 | sed -r 's/[ ]*$//')
fromaddr=$(echo $from | cut -d"<" -f2 | sed -r 's/>$//')
if ([[ "$1" == "nagios" ]] && [[ $(echo $subject | grep -Evc "^PROBLEM") -eq 1 ]])
then
exit
fi
export DISPLAY=":0"
notify-send -t 10000 "<span color=\"#0000FF\">You've got mail!</span>" "$(echo -e "<b>From:</b> $fromname\n<b>Address:</b> $fromaddr\n<b>Subject:</b> $subject")" &>/dev/null% echo $DISPLAY
:0
% cat .xinitrc
numlockx on &
urxvtd -q -o -f &
setxkbmap hr &
synclient TouchpadOff=1 &
exec ck-launch-session dbus-launch awesome
could you please help?
i have whole xorg package bundle isntalled, starting X with startx. tried with slim, modified DISPLAY to :0.0 but nothing.
Last edited by devil_kc (2012-06-21 11:24:49)
Offline
one more thing
if i test it from terminal via
cat mail | /home/user/bin/mail-notify - it works. but looks like .mailfilter cannot call it for some reason
Offline
I don't use maildrop (going to go and look up what it is*), but di use procmail.
I get procmail to notify me of incoming mail. If that seems like a good workaround, or preferable to getting maildrop to do it, I'll post the relevant bits of my procmailrc here.
EDIT* - okay, courier maildrop? Do you need it *and* procmail? I assume you do, but it does see, to do the same thing.
Last edited by skanky (2012-06-21 08:43:04)
"...one cannot be angry when one looks at a penguin." - John Ruskin
"Life in general is a bit shit, and so too is the internet. And that's all there is." - scepticisle
Offline
skanky, please post procmailrc, and a way how it notifys you so i can try it.
btw i tested it and maildro/.mailfiter starts mail-notify script but notify-send fails without any error.
Offline
Here's what I use:
# Used later for notifications
DISPLAY=:0
XAUTHORITY=$HOME/.Xauthority
#ONSCREEN="osd_cat --color=#fff5f2 -p middle -A center --wait --delay=5 --shadow=2 --font=lucidasans-14 -l 5 -"
ONSCREEN="notify-send --urgency=normal --app-name=mail"I used to use osd_cat until recently when I started using dunst, so switched to using notify-send. The DISPLAY and XAUTHORITY are (I think not needed if not using osd_cat - otherwise they are needed as procmail clears the environment for security reasons. There are other ways to get round it). The osd_cat was nicked from the web - the biggest issue is that multiple incoming mail causes lots of notifications to pile up.
I then use it like this:
# Display on screen
:0 c
* ^Subject:.*\/.*
{
SUBJECT=$MATCH
:0 ih
* ^From: .*\/[^<]*
| $ONSCREEN "$SUBJECT from $MATCH"
}
# Example
:0
* ^From: .*@(exampe.net|example.co.uk)
saved/suppliers/example/This announces all the incoming mail, and passes the mail on to further recipes below, eg example.
EDIT:
*) put junk filter rules above the notification if you don't want to be told about stuff that's deleted.
*) I nicked it from here: http://bethesignal.org/dotfiles/procmailrc.html
Last edited by skanky (2012-06-21 09:57:38)
"...one cannot be angry when one looks at a penguin." - John Ruskin
"Life in general is a bit shit, and so too is the internet. And that's all there is." - scepticisle
Offline
looks like it is a problem with notify-send. it wont work from console. from terminal it is ok, but from console doesn't work
strange:(
any ideas?
Offline
I might be misunderstanding you, but libnotify requires X, so I expect it needs a running X environment to work.
"...one cannot be angry when one looks at a penguin." - John Ruskin
"Life in general is a bit shit, and so too is the internet. And that's all there is." - scepticisle
Offline
ofc, i run X but if i go to tty1(or any other) and try expord DISPLAY=:0 and then notify-send something it doesn't work - exit status is 0 but nothing is displayed on desktop
Offline
got it to work with xfce4-notifyd. it is ugly but it works ![]()
Offline
That's good. ![]()
"...one cannot be angry when one looks at a penguin." - John Ruskin
"Life in general is a bit shit, and so too is the internet. And that's all there is." - scepticisle
Offline
maildrop sets up it's own environment variables and DISPLAY is not one of them. to fix this, simply export DISPLAY in your script and all should be fine (it is not enough to just set DISPLAY, you need to export it). e.g.:
file: $HOME/bin/mail-notify
#!/bin/sh
# maildrop doesn't have $DISPLAY set
export DISPLAY=:0;
notify-send --app-name=mail --expire-time 8000 "$( cat - | reformail -X From: -X Subject: )"
# ---------
# \
# comes with maildropand in your .mailfilter rules add something like this:
# to notify about all incoming mail, add this early in the file
exception {
cc "| $HOME/bin/mail-notify"
}
# as part of a given filter
if( /^From.*@example.com/:h )
{
exception {
cc "|$HOME/bin/mail-notify"
}
to $DEFAULT/example/
}Last edited by xing (2013-10-09 07:45:56)
Offline