Offlineimap "New Email" notification scripts

I recently started using offlineimap/mutt to keep track of three email accounts. I wanted notifications when new email arrived so I tried some notification programs that worked with Maildir but didn't find any that I liked. So I came up with this script:
#!/bin/sh
MAILDIR1=$HOME/Email/maildir1/INBOX/new
MAILDIR2=$HOME/Email/maildir2/INBOX/new
MAILDIR3=$HOME/Email/maildir3/Inbox/new
echo "Watching $MAILDIR1"
while MAILNAME1=$(inotifywait -qe MOVED_TO --format '%f' $MAILDIR1)
do
echo $MAILNAME1
mailpop $MAILDIR1/$MAILNAME1
done&
echo "Watching $MAILDIR2"
while MAILNAME2=$(inotifywait -qe MOVED_TO --format '%f' $MAILDIR2)
do
echo $MAILNAME2
mailpop $MAILDIR2/$MAILNAME2
done&
echo "Watching $MAILDIR3"
while MAILNAME3=$(inotifywait -qe MOVED_TO --format '%f' $MAILDIR3)
do
echo $MAILNAME3
mailpop $MAILDIR3/$MAILNAME3
done
I modified a script for procmail notifications I found here http://miek.nl/posts/2008/Jun/09/a-popu … rocmailrc/ for nicely formatted notifications and added two lines to speak the notification as well.
mailpop
#!/bin/bash
# popup a small notification with 'notify-send'
from=`formail -X From: < $1`
sub=`formail -X Subject: < $1`
# tweaks < > are special
from=${from//</\(}
from=${from//>/\)}
from=${from//&/\.}
sub=${sub//</\(}
sub=${sub//>/\)}
sub=${sub//&/\.}
sub=${sub:0:200}
from=${from:0:75}
TM=2000
/usr/bin/notify-send -u normal -t $TM "$from" "$sub"
while pgrep speech2 > /dev/null; do sleep 1; done
speech2 New Email ${from%(*}, With $sub, has arrived
#echo "New Email $from, With $sub has arrived" | festival --tts
At first I used festival for speech, but Google's voice sounded so much better. This script will speak up to 100 characters, just requires mplayer:
speech2
#!/bin/bash
say() { local IFS=+;/usr/bin/mplayer -ao alsa -really-quiet -noconsolecontrols "http://translate.google.com/translate_tts?tl=en&q=$*"; }
say $*
For messages with longer subjects: http://danfountain.com/2013/03/raspberr … to-speech/
Anyone else have a script/program they like for maildir notifications? Also I would be interested in making these work as a systemd user service.

For any other i3 users, jasonwryan script works great with i3status and i3bar useing the example from i3status manual:
i3status | while :
do
read line
echo "Email: $(eml) | $line" || exit 1
done
Edit: This is better, works with colors:
i3status | (read line && echo $line && read line && echo $line && while :
do
read line
dat=$(eml)
dat="[{ \"full_text\": \"Email: ${dat}\" },"
echo "${line/[/$dat}" || exit 1
done)
Last edited by kristopher004 (2015-03-01 18:19:00)

Similar Messages

  • How can I disable the new email notification pop-up window?

    When I am trying to perform timed Lumosity games and the new email notification window pops up over the window I'm working in, it's very disconcerting and bothersome. I'd like to disable this auto pop up, but can't find out how to do so.

    Tools (Alt-T) - Options - General - When new messages arrive
    Uncheck the notification(s).

  • Email Notification Script is Not Working in Windows Server 2012..

    Dears
    I have Server 2012 and I wants to make new task seclude for email notification, while any user is login to the
    server the server will send notification email about user name and IP address for the user, I have script it is working fine in windows 2008 and it is xml file, but the script is not working in 2012 because in task schedule in windows 2008 there is an option
    called send email but in windows 2012 this option is deprecated, I’m using start program to run the script in PowerShell instead of send email and I configured as an
     end-MailMessage
    -From [email protected]
    -Subject "Email Notification"
    -To [email protected]
    -SmtpServer mail.domainName.com
    But when I use this PowerShell I only receive email notification without any name and IP address, kindly I need
    your support and help, I’m using below script.
    <?xml version="1.0" encoding="UTF-16"?>
    < Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
      <RegistrationInfo>
        <Date>2013-11-27T11:16:32.3962177</Date>
        <Author>Company Name\User Name</Author>
        <Description>RDP Login V1</Description>
      </RegistrationInfo>
      <Triggers>
        <EventTrigger>
          <Enabled>true</Enabled>
          <Subscription>&lt;QueryList&gt;&lt;Query Id="0" Path="Security"&gt;&lt;Select Path="Security"&gt;*[System[(EventID=4624)]] and *[EventData[Data[@Name='LogonType'] and (Data=10)]]&lt;/Select&gt;&lt;/Query&gt;&lt;/QueryList&gt;</Subscription>
          <ValueQueries>
            <Value name="IpAddress">Event/EventData/Data[@Name="IpAddress"]</Value>
            <Value name="TargetUserName">Event/EventData/Data[@Name="TargetUserName"]</Value>
          </ValueQueries>
        </EventTrigger>
      </Triggers>
      <Principals>
        <Principal id="Author">
          <UserId>Company Name\User Name</UserId>
          <LogonType>Password</LogonType>
          <RunLevel>HighestAvailable</RunLevel>
        </Principal>
      </Principals>
      <Settings>
        <MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
        <DisallowStartIfOnBatteries>true</DisallowStartIfOnBatteries>
        <StopIfGoingOnBatteries>true</StopIfGoingOnBatteries>
        <AllowHardTerminate>true</AllowHardTerminate>
        <StartWhenAvailable>false</StartWhenAvailable>
        <RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
        <IdleSettings>
          <StopOnIdleEnd>true</StopOnIdleEnd>
          <RestartOnIdle>false</RestartOnIdle>
        </IdleSettings>
        <AllowStartOnDemand>true</AllowStartOnDemand>
        <Enabled>true</Enabled>
        <Hidden>false</Hidden>
        <RunOnlyIfIdle>false</RunOnlyIfIdle>
        <WakeToRun>false</WakeToRun>
        <ExecutionTimeLimit>P3D</ExecutionTimeLimit>
        <Priority>7</Priority>
      </Settings>
      <Actions Context="Author">
        <SendEmail>
          <Server>Name of the Server.com</Server>
          <Subject>RDP Login V1</Subject>
          <To>Sender Name</To>
          <From>Any Email.com</From>
          <Body>Login Alert on ServerName IP : $(IpAddress)  User: $(TargetUserName). Please take necessary action</Body>
          <HeaderFields />
        </SendEmail>
      </Actions>
    < /Task>

    Dears
    I have Server 2012 and I wants to make new task seclude for email notification, while any user is login to the
    server the server will send notification email about user name and IP address for the user, I have script it is working fine in windows 2008 and it is xml file, but the script is not working in 2012 because in task schedule in windows 2008 there is an option
    called send email but in windows 2012 this option is deprecated, I’m using start program to run the script in PowerShell instead of send email and I configured as an
     end-MailMessage
    -From [email protected]
    -Subject "Email Notification"
    -To [email protected]
    -SmtpServer mail.domainName.com
    But when I use this PowerShell I only receive email notification without any name and IP address, kindly I need
    your support and help, I’m using below script.
    <?xml version="1.0" encoding="UTF-16"?>
    < Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
      <RegistrationInfo>
        <Date>2013-11-27T11:16:32.3962177</Date>
        <Author>Company Name\User Name</Author>
        <Description>RDP Login V1</Description>
      </RegistrationInfo>
      <Triggers>
        <EventTrigger>
          <Enabled>true</Enabled>
          <Subscription>&lt;QueryList&gt;&lt;Query Id="0" Path="Security"&gt;&lt;Select Path="Security"&gt;*[System[(EventID=4624)]] and *[EventData[Data[@Name='LogonType'] and (Data=10)]]&lt;/Select&gt;&lt;/Query&gt;&lt;/QueryList&gt;</Subscription>
          <ValueQueries>
            <Value name="IpAddress">Event/EventData/Data[@Name="IpAddress"]</Value>
            <Value name="TargetUserName">Event/EventData/Data[@Name="TargetUserName"]</Value>
          </ValueQueries>
        </EventTrigger>
      </Triggers>
      <Principals>
        <Principal id="Author">
          <UserId>Company Name\User Name</UserId>
          <LogonType>Password</LogonType>
          <RunLevel>HighestAvailable</RunLevel>
        </Principal>
      </Principals>
      <Settings>
        <MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
        <DisallowStartIfOnBatteries>true</DisallowStartIfOnBatteries>
        <StopIfGoingOnBatteries>true</StopIfGoingOnBatteries>
        <AllowHardTerminate>true</AllowHardTerminate>
        <StartWhenAvailable>false</StartWhenAvailable>
        <RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
        <IdleSettings>
          <StopOnIdleEnd>true</StopOnIdleEnd>
          <RestartOnIdle>false</RestartOnIdle>
        </IdleSettings>
        <AllowStartOnDemand>true</AllowStartOnDemand>
        <Enabled>true</Enabled>
        <Hidden>false</Hidden>
        <RunOnlyIfIdle>false</RunOnlyIfIdle>
        <WakeToRun>false</WakeToRun>
        <ExecutionTimeLimit>P3D</ExecutionTimeLimit>
        <Priority>7</Priority>
      </Settings>
      <Actions Context="Author">
        <SendEmail>
          <Server>Name of the Server.com</Server>
          <Subject>RDP Login V1</Subject>
          <To>Sender Name</To>
          <From>Any Email.com</From>
          <Body>Login Alert on ServerName IP : $(IpAddress)  User: $(TargetUserName). Please take necessary action</Body>
          <HeaderFields />
        </SendEmail>
      </Actions>
    < /Task>

  • Unwanted 'New Email' notification on home screen

    Havin read some of the posts on this board concerning email notification messages, i went to
    menu-tools-settings-general-personalisation-homesc​reen-mode settings-homescreen applications-enabledapplications, and unticked both email1 and email2 notifications, and yet I still get the message every time I recieve an email on the mail for exchange.
    any suggestions?
    also it does seem pretty absurd the setttings are buried away in these menus to such an extent you have to look it up online to sort the navigation...

    I agree with you. The Nokia Messaging gives you the push mail, but the notification on the phone is poor. You have to open the Nokia Mail app on the 5800 to see the message. Without V30 if new mail arrives and you miss the beep there is no indication from the home screen of new mail.
    Even with V30 unfortunately you can only see the most recent email that has arrived on the home screen- and for some reason it still shows it as unopened once you've read it i.e. the closed envelope rather then opened.
    FYI- you can turn the email notification on the home screen off.
    I'm still amazed that there isn't a unified app that brings SMS, Mail, Chat etc all into the same window. So you only have to check in one place for incoming communication. Maybe there's a third party solution out there??
    Maybe one of the other Nokia phones has this, E72?

  • Possible to set new email notifications?

    *Is it possible to set a repeating notification for received email?*
    One short beep is not enough. If I am away from my desk I need to press the home button, swipe to unlock and see if I have new email each time. If I keep the phone on me I do not always feel the single notification beep.
    Don't most phones beep repeatedly every minute or so to notify you of new email.
    Even the text message app at least shows you have a new message by just pressing the home button.
    I vote for a small pin hole LED on the next phone that alerts the user of a new email.

    Thanks for your post -- _It is not now possible to set repeating mail notifications_.
    But please be sure to share your suggestions with Apple:
    http://www.apple.com/feedback/iphone.html
    They do read suggestions. Hope you are enjoying your iPhone!

  • I have a new email notification that won't go away, (Exchange), though I do not have a new email. How do i resolve this?

    I have a notification for my Exchange account saying I have a new email. Though, I don't and there are no unread emails in that account. How do I get rid of this? Any ideas?

    Try tapping Settings > Mail, Contacts, Calendars > your Exchange account > turn Mail off and see if the badge goes away. Then turn Mail back on for the Exchange account.
    If that doesn't do it, you can try restarting or restoring the iPhone.

  • Reply to emails from new email notification area (top left) in status bar?

    Hi, all
    setting up the new playbook. everything is working: email, internet, tethering, blackberry bridge...
    I have come across one problem though:
    i found that I cannot reply to an email when open from notification area. i.e when new email arrives, ntification flashes in the corner. when I press to open the new email I see all the buttons, but nothing happens. I would very muxh like to reply to email from that window.
    Is there something wrong with the playbook, or is it designed that way?

    Works just fine for me. The list opens when Itap the notification area. When I tap on the title or letter icon  for the new email, it opens in edit-reply mode.
    Edit: Not quite the truth... I have to click on the reply icon at the bottom of the just-opened message  - the envelope icon with the left green arrow.
    In the dark and need a sky map?
    Discover What's up at App World.
    Follow What's up on Facebook

  • Can't turn off new email notifications. (iphone5)

    Randomly, I started getting pinged with every incoming email even though I have sounds for new email set to off.  Silent vs. non-silent doesn't make a difference. (iphone5)

    Check Settings > Notifications > Mail > [each and every email account you have] > New Mail Sound

  • New Email notification only looks unread for about 3 minutes even if I have not read the message

    I have just started using Microsft Outlook to use my yahoo account. Both of those services show a new message as unread indefinitely but for some reason, my 8310 only shows the new email as new for about 3 minutes.
    In the BB Mail-Options General options - I have the Display Message count as Unread, and the Display New Message INdicator as Yes, and under the Email Reconciliation it reads On. It used to work fine but all of the sudden something has changed.
    Does anyone have any tips on this issue? I would hate to miss an important new message when I am traveling.

    Take it to apple store and don't replace it with the new one my son had the same problem he was in there about 10 minutes and walked out with a new phone

  • Late New Email notification sound

    Hi,
    sometimes my MacBook Pro plays the new email sound after I have already read that mail and deleted it. Why is that? Its quite anoying. Can I do something with it?
    Thanks.
    Milan

    this is happening to me too. hope you get an answer!

  • Close new email notification icon

    How can I have the new message notification icon disappear from the toolbar even without opening the new message>

    That's something that can't be disabled that I've ever seen.
    If I successfully help you with an issue, thank you for clicking "kudos" in my post.
    If your issue has been solved, please resolve this thread by marking the post which solved it for you!

  • SCOM enhanced email notification script V2.1

    Hi
    I have tested this scripts and it works great. But when I get alerts from network monitoring some informastion is missing. Does anyone know how to add "Full Path Name" and "Description" from Entity Properties. For Network Port monitor
    "Full Path Name" display name/scom portname and description display information like Ethernet1/31.
    Please advice
    Jon

    email notification script V2.1 is using powershell get-alert
    you may use
    $alert=Get-Alert-Id$alertID
    $alert.description: Description
    $alert.MonitoringObjectPath: Full Path Name
    Roger

  • New email notifications. I WANT TO STOP THEM.

    Hello Is there anyway I can stop these pointless email notifications I keep receiving every time i sign in to my icloud, don't care about the celebrity hacking, I just don't want a email over and over.

    If they are coming to your iCloud address you could go to the iCloud website, go to the Mail page, click on the cogwheel icon at bottom left, choose 'Rules' and set up a Rule to move all messages from [email protected] to another folder you previously created, or the Trash. If they are coming to a non-Apple address you can do the same thing in the Mail app on your Mac (presumably also on mobile devices though I don't know about that).

  • New Email Notification Sound

    Hi,
    These Apple devices are getting a little popular. At my workplace I always hear the same old "ding" everytimes someone gets an email so a number of us reach for our devices to see which one it was for.
    We are up to iOS4 so I imagine it is a choice to not allow configurable notification sounds. What possible (sensible) reason can there be?! It isn't exactly a complext feature.
    The renowned Apple consistancy in operation is good but not for notifications. thats just confusing.

    You can change your email alert sounds through the use of a free app. Download Boxcar from the app store, and have it alert you when an email arrives with one of its sounds. You can then turn off the email received sound in the settings on the iPad.
    We do this in my house with 3 iphones and 2 ipads constantly dinging. Each person has a unique email arrival sound.

  • New email notification...

    So, my mail icon says I have three unread messages, when I go to the account with the allegedly unread messages, I see Inbox (3), but there are no unread messages. any ideas?

    Does it say 3 messages total, 3 unread, download more messages?
    If yes the only way to fix that is a restore. Same thing with me. I found an app that cause mail on the phone to do this and removed it. Unless I restored, no mail would be visible in that account ever.
    Restore is a pain, but I've even deleted everything on my phone to make sure there weren't any files left (2 hours for a 16 gig phone) and restored yet again. Mail on the phone still doesn't work for more than 2 or 3 hours before I have to shut the phone down and start up again, but at least I can see the mail.
    What apps do you have on your phone? My Weather Mobile (a great app BTW) at this time screws up my mail. I'm waiting on an update on that app before I reinstall it.
    Hope this helps.
    CD3
    Message was edited by: CD3

Maybe you are looking for

  • Memory on laptop getting low

    I'm sorry I can't find an answer to my question. If there is a post somewhere that answers it, feel free to post the link. My question is this: The memory on my iBook is getting dangerously low and it's the songs in iTunes that is taking up a good ch

  • Color change on exporting from lightroom and saving in Photoshop CS5

    I have been having issues with my pictures with color management.    I have Lightroom 4 and Photoshop CS5.  I thought over the last 2 years that it was just me.   I have bought a Eizo monitor with a hood, calibrate with a i1display pro, painted my wa

  • External speaker on ipod touch

    Does the ipod touch have an external speaker on it so you don't always have to use headphones?

  • / the only supposedly "mounted" partition, fs segfaults / 3.1.0-4

    [Update: Rebooting fixed the fs segfaults (were they segfaults?) although the "mounting filesystems... [FAIL]" message is still present.] I should probably have paid closer attention to the fact that ever since I went from 2.6 to 3.0 Arch has been sa

  • Migrating a Cisco ACS Database

    Hi, Can there be any potential problems, if we want to migrate an existing Cisco ACS Database to a different physical Server (Keeping the same IP information etc) ? We were running Cisco ACS evaluation version for Cisco NAC (CTA) and now want to make