Email notifications plugin revisited

Want to share your OpenWrt / Gargoyle knowledge? Implemented a new feature? Let us know here.

Moderator: Moderators

dpint
Posts: 32
Joined: Fri Oct 31, 2014 10:48 am

Re: Email notifications plugin revisited

Post by dpint »

Do emails arrive if you run following command?

Code: Select all

sh /usr/lib/gargoyle/email.sh

b17gsr
Posts: 54
Joined: Tue Dec 08, 2015 10:58 pm
Location: Canada

Re: Email notifications plugin revisited

Post by b17gsr »

charlie wrote:Fixed finally and now rocking with Gargoyle :)

In case someone having the same issue:
I have replaced "ntls-cert-file" string in /plugin_root/www/js/email.js with "ntls_trust_file" (tnx Dustinizer) and after that configured email and saved changes which caused that /etc/msmtprc file is generated with proper parameters - "tls_trust_file /etc/ssl/certs/ca-certificates.crt" instead of "tls-cert-file /etc/ssl/certs/ca-certificates.crt"
But that was not all in my case - /usr/lib/gargoyle/email.sh script had only read permission and that was reason why script wasn't executed on schedule. After i changed that and added execute permission email notification on schedule started to work normally.


This corrected my issue. Thanks
Linksys WRT3200ACM on 1.10.x
D-Link DIR-890L/R access point with blah stock firmware
--- Retired ---
TP-LINK Archer C7 v2 on 1.9.2

b17gsr
Posts: 54
Joined: Tue Dec 08, 2015 10:58 pm
Location: Canada

Re: Email notifications plugin revisited

Post by b17gsr »

All of the automated emails are shifting the table header one column for the recently visited sites. All other table headers are ok. Here's an example of the issue:

Recently visited sites:

Time/ | **BLANK CELL** | IP address | Website

Then the data appears:

time & date | IP | website


Which file to edit to correct?

thanks
Linksys WRT3200ACM on 1.10.x
D-Link DIR-890L/R access point with blah stock firmware
--- Retired ---
TP-LINK Archer C7 v2 on 1.9.2

dpint
Posts: 32
Joined: Fri Oct 31, 2014 10:48 am

Re: Email notifications plugin revisited

Post by dpint »

Hello!

Thank you for pointing this out.

You can see which file you have to modify here:

https://github.com/dpint/gargoyle/commi ... e9a32fbb11

b17gsr
Posts: 54
Joined: Tue Dec 08, 2015 10:58 pm
Location: Canada

Re: Email notifications plugin revisited

Post by b17gsr »

Success! Thanks
Linksys WRT3200ACM on 1.10.x
D-Link DIR-890L/R access point with blah stock firmware
--- Retired ---
TP-LINK Archer C7 v2 on 1.9.2

b17gsr
Posts: 54
Joined: Tue Dec 08, 2015 10:58 pm
Location: Canada

Re: Email notifications plugin revisited

Post by b17gsr »

Would it be possible for the emails to include daily usage for the top 10 users?
Linksys WRT3200ACM on 1.10.x
D-Link DIR-890L/R access point with blah stock firmware
--- Retired ---
TP-LINK Archer C7 v2 on 1.9.2

dpint
Posts: 32
Joined: Fri Oct 31, 2014 10:48 am

Re: Email notifications plugin revisited

Post by dpint »

b17gsr wrote:Would it be possible for the emails to include daily usage for the top 10 users?


Yes, it would be possible, but currently I have no plans on adding any additional functionalities to this plugin.

camartinez1229
Posts: 1
Joined: Mon Feb 22, 2016 11:33 am

Re: Email notifications plugin revisited

Post by camartinez1229 »

Hello, everyone. I'd like to share the nightmare I experienced in trying to get the email notifications plugin to work, and how I finally got it working.

So, yesterday, I newly installed Gargoyle 1.8.1 on my TP-Link TL-WDR3600, which went surprisingly easily. I was very pleased!

And then later in the evening, I thought it might be cool to get email notifications of bandwidth usage and stuff like that? And so I looked, and sure enough, there is such a plugin. Cool! So, I installed the 1.0-1 one that's offered in the plugins list.

Getting correct SMTP settings working was a hassle in itself, but I finally had to settle on smtp.google.com with credentials. I would've rather used a local SMTP server on my Windows 7 laptop, but nothing I tried could send a test email successfully.

So, I got the test email working, finally... But then, scheduled emails wouldn't send! Ugh... So, I Googled around and found the updated email plugin... But wow, that plugin turned out to be a hassle! I couldn't get it to install properly. I'd try to install it manually with ipkg command, but it'd tell me that the postinstall script wouldn't launch or whatever... but it still claimed the package installed successfully. However, "Email" wouldn't show up in the menu. I found the fix for that, but then the actual page for it still wouldn't load properly... Not fun! So, I uninstalled the updated email plugin entirely and reverted to 1.0-1... at least that installs properly and I can use the configuration page for it...

But, my original problem of scheduled emails not working, remained... Until I finally figured it out, though!

Executing email.sh in a WinSCP terminal works, which was interesting...I could manually send email, but that wasn't gonna be enough. I verified that there was a cronjob for the schedule I set... okay, good. But, still not enough. So, I navigated to email.sh in WinSCP and opened the file in my text editor. At the very end, I commented out the line that deletes email-log.txt, and then scheduled an email to go out at the next 5-minute interval. For good measure, I also set 0777 permissions on the file.

Aha! After I did that, I checked after the scheduled time, and found email-log.txt in the file listing. So, the cronjob was indeed running now. But, the email still wasn't sending...

I then figured out from Google that cronjobs are run in a very minimal environment or whatever? Maybe it didn't know how to interpret just "sendmail"? So, I put the full path to sendmail, "/usr/sbin/sendmail", and scheduled another email at the next 5-minute interval.

Finally, success! I got an email!

I then dialed back the permissions on email.sh to 0644, but, that didn't work. 0744 works, though. I don't recall what the default permissions were before I fiddled with the file. So, I'm keeping it at 0744, and then I fixed my schedule to the daily email I want, and now I'm all good.

TL;DR: I finally got the original email plugin working on Gargoyle 1.8.1 on my WDR-3600! I had to set 0744 permissions on /plugin_root/usr/gargoyle/email.sh, and edit email.sh toward the end, specifying the full path to sendmail as "/usr/sbin/sendmail".

And just for completion, my SMTP settings are smtp.gmail.com on port 587 with TLS and credentials. I had to create an "app password" on my Google account to get around two-factor authorization (which I really don't like anymore, but oh well.) Is there any simple way of using a local SMTP server software on my Windows 7 laptop to do this, though?

dpint
Posts: 32
Joined: Fri Oct 31, 2014 10:48 am

Re: Email notifications plugin revisited

Post by dpint »

So, I got the test email working, finally... But then, scheduled emails wouldn't send! Ugh... So, I Googled around and found the updated email plugin... But wow, that plugin turned out to be a hassle! I couldn't get it to install properly. I'd try to install it manually with ipkg command, but it'd tell me that the postinstall script wouldn't launch or whatever... but it still claimed the package installed successfully. However, "Email" wouldn't show up in the menu. I found the fix for that, but then the actual page for it still wouldn't load properly... Not fun! So, I uninstalled the updated email plugin entirely and reverted to 1.0-1... at least that installs properly and I can use the configuration page for it...


I fixed packages, so they should install fine now.

I then figured out from Google that cronjobs are run in a very minimal environment or whatever? Maybe it didn't know how to interpret just "sendmail"? So, I put the full path to sendmail, "/usr/sbin/sendmail", and scheduled another email at the next 5-minute interval.


It works fine for me. No one reported this before, so I guess it works for others too.


And just for completion, my SMTP settings are smtp.gmail.com on port 587 with TLS and credentials. I had to create an "app password" on my Google account to get around two-factor authorization (which I really don't like anymore, but oh well.) Is there any simple way of using a local SMTP server software on my Windows 7 laptop to do this, though?


Yes, it is possible. You can use software like hMailServer to create local SMTP server, but mails will probably go to spam folder, so you will have to whitelist them.

DrJase
Posts: 4
Joined: Mon Sep 07, 2015 5:44 pm

Re: Email notifications plugin revisited

Post by DrJase »

I have downloaded the latest .ipk files for email notifications.

Please could someone provide an idiots step by step guide to install them on my router please.

Thanks in advance.

Post Reply