auanasgheps / snapraid-aio-script

The definitive all-in-one SnapRAID script on Linux. Diff, sync, scrub are things of the past. Manage SnapRAID and much, much more!
GNU General Public License v3.0
231 stars 37 forks source link

[Feature] Add from address to email notification and a user-created script instead of the default email #29

Closed Caedis closed 2 years ago

Caedis commented 2 years ago

The from address addition is straight forward.

The user-created script gets the subject and body (in that order) so that the user can do whatever they want with it and without editing the main script.

Sorry for the whitespace fixes, if needed, I can diff and patch them out.

auanasgheps commented 2 years ago

Hello! Thanks for the contribution!

Space fixes are minor but definitely appreciated.

What is the goal of the user script? To use an external notification system? Can you provide some real life examples?

The user can already configure a different mail binary in the config file.

Caedis commented 2 years ago

While being able to change the mail binary, you can not change the parameters that is passed to it, so you would have to use something that works with everything that is passed in.

An example would be:

HOOK_NOTIFICATION="$CURRENT_DIR/email_script.sh"

email_script.sh:

curl -s --user 'api:my_api_key' \
https://api.mailgun.net/v3/my_domain/messages \
-F from=from_address \
-F to=to_address \
-F subject="$1" \
-F text="$2"
Caedis commented 2 years ago

need to make a couple changes

auanasgheps commented 2 years ago

While being able to change the mail binary, you can not change the parameters that is passed to it, so you would have to use something that works with everything that is passed in.

An example would be:

HOOK_NOTIFICATION="$CURRENT_DIR/email_script.sh"

email_script.sh:

Allright, It makes sense now :)

need to make a couple changes

No problem. Let me know when ready

Caedis commented 2 years ago

Feel free to make any changes before merging

auanasgheps commented 2 years ago

@Caedis I merged a PR created before yours. These are small changes and they do not interfere with yours, but there are some conflicts according to GitHub. Can you rebase your changes based on the current versions? I won't make other changes, I promise!

Caedis commented 2 years ago

Can do

Caedis commented 2 years ago

There we go....i need more experience with rebasing

auanasgheps commented 2 years ago

Looks good now!