What's new

amtm I want to leverage the email function within amtm

Ripshod

Part of the Furniture
I'm adapting a little script to notify me when a file changes (comparing md5 checksums) but it was originally written to use sendmail (built into asuswrt/busybox). Needless to say it fails. What I'd like to do is use the email functionality in amtm to handle emails, but I just don't know where to start (my sending email is already set up and working in amtm).
Any pointers?
 
I'm adapting a little script to notify me when a file changes (comparing md5 checksums) but it was originally written to use sendmail (built into asuswrt/busybox). Needless to say it fails. What I'd like to do is use the email functionality in amtm to handle emails, but I just don't know where to start (my sending email is already set up and working in amtm).
Any pointers?
Look at the code of other 3rd-party scripts such as MerlinAU or BACKUPMON that have incorporated this functionality.
 
I'm adapting a little script to notify me when a file changes (comparing md5 checksums) but it was originally written to use sendmail (built into asuswrt/busybox). Needless to say it fails. What I'd like to do is use the email functionality in amtm to handle emails, but I just don't know where to start (my sending email is already set up and working in amtm).
Any pointers?
Like to see a clear answer on this myself. In the meantime here is a snippet of what I came up with that works.

Code:
[email protected]

      NEW_ADDR=`cat /opt/ipchange/last_ip`
        {
         echo From: rt-be88u.dbonenet.com
         echo To: [email protected]
         echo Subject: External IP Address Change
         echo
         echo -n New IP ADDRESS:
         echo ' [ '$NEW_ADDR' ] '
        } | /usr/sbin/sendmail  -H 'exec openssl s_client -quiet -verify_quiet -tls1_3 -CAfile /opt/etc/ssl/cert.pem -connect mail.dbonenet.com:465' $M_ADDR 2>/dev/null
 
Look at the code of other 3rd-party scripts such as MerlinAU or BACKUPMON that have incorporated this functionality.

MerlinAU actually has all the email code integrated directly into the add-on, which may be a bit trickier to digest, but removes any dependencies on external code for MerlinAU.
However @Viktor Jaep 's BACKUPMON uses the Shared Email Library from @Martinski , which is what I would recommend as a starting point and is the simplest implementation.

The library is specifically designed to be a detached "all-in-one" solution other scripts/add-ons can call on to leverage email functionality:
 
Last edited:
@Ripshod ... if you've downloaded BACKUPMON, RTRMON, VPNMON-R3 or TAILMON, and enabled email notifications for any of these, then you will have downloaded the shared email library... you should be able to find it under /jffs/addons/shared-libs. Let me know if I can help with anything. ;)
 
@Ripshod, another option for you is to copy and use the code written by AMTM's author himself, @thelonelycoder within either one of the two scripts (if you have them installed from the AMTM menu)

"Scripts update notification" script located at:
/jffs/addons/amtm/sc_update.mod
OR
"Firmware update notification" script located at:
/jffs/scripts/update-notification

However, if you have neither of them installed in your router, you can search for the source files, or just install the scripts temporarily to copy the code.
 
@Ripshod, another option for you is to copy and use the code written by AMTM's author himself, @thelonelycoder within either one of the two scripts (if you have them installed from the AMTM menu)

"Scripts update notification" script located at:

OR
"Firmware update notification" script located at:


However, if you have neither of them installed in your router, you can search for the source files, or just install the scripts temporarily to copy the code.
Spot on, short & sweet and easy to 'hack' to send whatever you want !!!

:)
 

Latest threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Back
Top