Email notifications plugin revisited

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

Moderator: Moderators

toktok
Posts: 7
Joined: Sun Mar 16, 2025 12:36 pm

Re: Email notifications plugin revisited

Post by toktok »

Hi,

I have now installed Gargoyle on a router with 16 MB of flash memory to be able to make use of some of the nice plugins that are available, including "Email notifications for Gargoyle (with SSL support) 2.0-3".

However, all emails that I received from Gargoyle showed no content, neither with Thunderbird, nor when viewed via my email provider's webmail portal. (basically like what other users mentioned before here in this thread)
I could see that the content was actually there by viewing the source code of the emails in Thunderbird.
These emails also show with a date of 1970/1/1 in Thunderbird.

After poking around in the code (I am not an expert) and comparing to other emails that display properly I found that adding an empty line before the actual html code fixed the whole problem.
I do not know why this empty line is apparently so important, but I found it in every email that I checked. (I mean every email other than the ones sent by Gargoyle)

So, in "email.sh" I changed the line
echo -e "Subject: Gargoyle Router report - $(date)\r\nFrom: $(cat /etc/msmtprc | grep from | sed "s/ from //")\r\nContent-Type: text/html; charset='UTF-8';\r\n<html><body>" > /tmp/email-log.txt;
to
echo -e "Subject: Gargoyle Router report - $(date)\r\nFrom: $(cat /etc/msmtprc | grep from | sed "s/ from //")\r\nContent-Type: text/html; charset='UTF-8';\r\n\r\n<html><body>" > /tmp/email-log.txt;

I think the same modification would need to be made in "email.js" ("function testMail()") in order to have emails sent by "Send test email" displayed properly, but that is really just a cosmetic issue.

Lantis
Moderator
Posts: 7063
Joined: Mon Jan 05, 2015 5:33 am
Location: Australia

Re: Email notifications plugin revisited

Post by Lantis »

toktok wrote:
Wed Mar 19, 2025 5:25 pm
Hi,

I have now installed Gargoyle on a router with 16 MB of flash memory to be able to make use of some of the nice plugins that are available, including "Email notifications for Gargoyle (with SSL support) 2.0-3".

However, all emails that I received from Gargoyle showed no content, neither with Thunderbird, nor when viewed via my email provider's webmail portal. (basically like what other users mentioned before here in this thread)
I could see that the content was actually there by viewing the source code of the emails in Thunderbird.
These emails also show with a date of 1970/1/1 in Thunderbird.

After poking around in the code (I am not an expert) and comparing to other emails that display properly I found that adding an empty line before the actual html code fixed the whole problem.
I do not know why this empty line is apparently so important, but I found it in every email that I checked. (I mean every email other than the ones sent by Gargoyle)

So, in "email.sh" I changed the line
echo -e "Subject: Gargoyle Router report - $(date)\r\nFrom: $(cat /etc/msmtprc | grep from | sed "s/ from //")\r\nContent-Type: text/html; charset='UTF-8';\r\n<html><body>" > /tmp/email-log.txt;
to
echo -e "Subject: Gargoyle Router report - $(date)\r\nFrom: $(cat /etc/msmtprc | grep from | sed "s/ from //")\r\nContent-Type: text/html; charset='UTF-8';\r\n\r\n<html><body>" > /tmp/email-log.txt;

I think the same modification would need to be made in "email.js" ("function testMail()") in order to have emails sent by "Send test email" displayed properly, but that is really just a cosmetic issue.
Thanks for reporting this and including a fix.
I will take this and fix it when I can.
https://lantisproject.com/downloads/gargoylebuilds for the latest releases
Please be respectful when posting. I do this in my free time on a volunteer basis.

Post Reply