Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Email script : A complement to unraid_notify

Featured Replies

Hi Everyone, I am a long time reader but this is my 1st post!

 

I made a small package to add email support using the bashmail script from unraid_notify package. Credits goes to brainbone for unraid_notify package.

 

It use the same config file as unraid_notify (/boot/config/unraid_notify.cfg). I made this to enable sending email from any scripts and/or crontab jobs without using unraid_notify.

You still have to install unraid_notify-2.20-noarch-unRAID.tgz package *BUT* you don't have to start it if you don't want to.

 

Syntax: mail [--subject 'subject'] [--rcpt '[email protected]']"

 

Samples Usage:

  cat filename.txt | mail

  echo 'this is a test' | mail

  echo 'this is a test' | mail --subject 'ATTENTION'

  echo 'this is a test' | mail --subject 'ATTENTION' --rcpt [email protected]

 

You can override the subject and the rcpt from the configuration file (unraid_notigy.cfg) with the optionals parameters.

 

Regards

Mike

 

 

  • 3 weeks later...

@mikep

 

I was just getting ready to write something like this to use bashmail, and you have already done it.

 

Thank you.

 

I did make one change, so that the recipient comes from "ErrorRcptTo" and not "RcptTo" since a lot of people leave the latter blank, as they only want e-mail in the event of errors.

Nice work!

 

Just  a note:  I updated unraid_notify to version 2.30, fixing some bugs dealing with the "To:" field in the message header and multiple recipients.  bashmail was also updated, using EHLO instead of HELO, allowing authentication with earthlink smtp servers.

 

I'm just curious. Why would you want (or need) to use this package instead of brainbone's script or is there a different purpose for this package?

 

I guess with this, you can send emails from any script that has an output?

 

What would be some practical applications of this?

 

Thanks

Chris

I'm just curious. Why would you want (or need) to use this package instead of brainbone's script or is there a different purpose for this package?

 

I guess with this, you can send emails from any script that has an output?

 

What would be some practical applications of this?

 

Thanks

Chris

Some of the add-on scripts can be configured to use mail to communicate their status.  the APC UPS daemon is one. (I used my own script that in turn uses netcat for the actual connection to the mail server, but this is equally capable.)
  • Author

I'm just curious. Why would you want (or need) to use this package instead of brainbone's script or is there a different purpose for this package?

 

I guess with this, you can send emails from any script that has an output?

 

What would be some practical applications of this?

 

Thanks

Chris

 

I wrote that script to use with APC UPS daemon and also some custom cron jobs...

Regards

Mike

 

 

OK. I tried to play with this a bit to see what I could do.

 

For example, I wrote a little script to save a text file containing the SMART info from drive #1 then email this to me.

 

Here's the script:

 

smartctl  -a  -d  ata  /dev/sdc | todos >/boot/smart.txt

cat /boot/smart.txt | mail --subject 'SMART info Disk1' --rcpt [email protected]

 

When I look at the email I get, the formatting is messed up. It looks like it doesn't print the tabs, so all the columns in the report do not line up and it's hard to read. If I check the text file, it's OK. Is there a way to keep the formatting intact? I tried using todos and not using it but it made no difference.

 

I also tried using "show in fixed width font" in Gmail but that didn't help either.

 

Any suggestions?

 

Thanks

Chris

Might there be a way to add an SMS feature.  I can send an email to my phone with this script via SMS (i.e. [email protected]), and this works just fine.

 

The problem I'm trying to avoid is that the default message creates 2 SMS texts because there are so many lines included in the message (FRM, SUBJ, MSG, Server Name, Date, and the message.)

 

If there were an SMS option (switch) so that only the message (or subject) were actually sent, that would be great.  I'd use this feature to notify me of specific 'events' (such as rsync completed sucessfully).

  • 1 month later...

Here is the modified script to put in a couple of changes that brianbone added to make earthlink on the unraid_notify work.

 

you can use it if you want..  but it's mainly for me when I forget about where I put my modified copy! :-)

(remove the .txt in the file name)

  • 2 months later...

Here is an updated version that more conforms to the berkley standard for mail.  It will either take the old parameters or the standard ones.

 

So

 

Samples Usage:

  cat filename.txt | mail

  echo 'this is a test' | mail

  echo 'this is a test' | mail --subject 'ATTENTION'

  echo 'this is a test' | mail --subject 'ATTENTION' --rcpt [email protected]

 

All still work or...

 

  cat filename.txt | mail

  echo 'this is a test' | mail

  echo 'this is a test' | mail -s 'ATTENTION'

  echo 'this is a test' | mail -s 'ATTENTION' [email protected]

 

Will also work.

 

This still requires unraid_notify to be installed

 

The program is attached..  just remove the .txt

Or the whole package is there too...

 

 

 

What are everyone's thoughts on rolling this in to unraid notify?

 

Fine with me!

Works for me, the more options and more we can comply to the standards the better!  I think making unRAID notify and this e-mail script one is a good thing in the long run so as not to confuse new people.

Works for me, the more options and more we can comply to the standards the better!  I think making unRAID notify and this e-mail script one is a good thing in the long run so as not to confuse new people.

 

I strongly agree.

Archived

This topic is now archived and is closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.