What's new

Notifications (E-Mail)

Minglarn

Occasional Visitor
Hi! This is my first post and sorry if this has been discussed before (did a search in the forum but it returned 0 results)

I've upgraded my poor/old D-Link 655 to this eminent router and really like the touch and speed, but I'm missing one part.... And that is to be notified when something is wrong. My 655 did e-mail me when it restarted (after a power loss or similar) or when something went wrong.

Is this possible to implement to the Asus RT-66U?
 
Last edited:

nubyOz

Regular Contributor
Hi,
Would to a great feature.
Could use it to tell me the current WAN IP for remote access.
Don't like a DDNS name.

Cheers
 

RMerlin

Asuswrt-Merlin dev
The router comes with the sendmail command. In theory you could create a services-start script that would automatically send an Email when services are restarted (such as at boot time), or on wan-start (when the WAN interface comes up). However I have never managed to get that Sendmail command to work properly here. My ISP's SMTP returns nothing, and my hosting's SMTP gives me a bad recipient despite the fact the recipient address is perfectly fine. It's possible that Busybox's sendmail applet is quirky, if not broken.
 

Minglarn

Occasional Visitor
Intresting! As My Linux knowlege is nearly zero i've to ask for help.
Or if there are any good wiki for this I've appreciate it.
 

RMerlin

Asuswrt-Merlin dev
I found some time to actually work out the syntax and a simple example for a script that will send Email notifications from your router. See this Wiki page I just added.
 

RMerlin

Asuswrt-Merlin dev
I am trying to set sendmail with my gmail account:
echo "This is a test email." | /usr/sbin/sendmail -S smtp.gmail.com:587 -f [email protected] [email protected] -au [email protected] -ap mypassword
But I get every time:
sendmail: AUTH LOGIN failed
From pc I am abble to send emails with port 25 or 587
Don't put any space between the switch and the values. Also try putting those values within "". Using quotes in my test script worked for me when I used my hoster's SMTP with authentication. And put the TO address at the end (after the auth arguments).

That's what I meant in my earlier reply about busybox's applet being quirky. Took a fair amount of trial and errors for me to get it working properly :)
 

TeHashX

Very Senior Member
Didn't worked
echo "This is a test email." | /usr/sbin/sendmail -S"smtp.gmail.com:25" -f"[email protected]" -au"[email protected]" -ap"password" "[email protected]"
or
echo "This is a test email." | /usr/sbin/sendmail -Ssmtp.gmail.com:25 [email protected] [email protected] -appassword [email protected]

than I tryed with another account, not gmail, and I didn't get any error in terminal but I received mail failure notice in the inbox:

I'm afraid I wasn't able to deliver your message to the following addresses.
This is a permanent error; I've given up. Sorry it didn't work out.
Unable to run qmail-remote.
Received: (qmail 15621 invoked by uid 108); 11 Oct 2012 11:17:48 -0400
Received: from unknown (HELO none)
 

RMerlin

Asuswrt-Merlin dev
GMail does not support PLAIN AUTH, only through TLS:

[email protected]:/tmp/home/root# telnet smtp.gmail.com 25
220 mx.google.com ESMTP hg2sm209871igc.3
ehlo test.com
250-mx.google.com at your service, [xxx.xxx.xxx.xx]
250-SIZE 35882577
250-8BITMIME
250-STARTTLS
250 ENHANCEDSTATUSCODES
quit
221 2.0.0 closing connection hg2sm209871igc.3
Connection closed by foreign host
 

RMerlin

Asuswrt-Merlin dev
So, nothing to do...

Sent from my HTC One V using Tapatalk 2
You could use your ISP's SMTP, provided it works either without authentication or with plain text authentication.
 

TeHashX

Very Senior Member
I finally did it, this is my configuration in wan-start script:

#!/bin/sh
SMTP="my_isp_smtp:25"
FROM="my_isp_email_adress"
FROMNAME="RT-N66U"
TO="my_gmail_adress"

echo "Subject: WAN state notification" >/tmp/mail.txt
echo "From: \"$FROMNAME\"<$FROM>" >>/tmp/mail.txt
echo "Date: `date -R`" >>/tmp/mail.txt
echo "I just got connected to the RDS." >>/tmp/mail.txt
echo "My new IP is: `nvram get wan0_ipaddr`" >>/tmp/mail.txt
echo "" >>/tmp/mail.txt
echo "--- " >>/tmp/mail.txt
echo "Your friendly router." >>/tmp/mail.txt

cat /tmp/mail.txt | /usr/sbin/sendmail -S"$SMTP" -f"$FROM" $TO
-au"my_isp_username" -ap"my_isp_password"

rm /tmp/mail.txt

THX Merlin
 
Last edited:

Minglarn

Occasional Visitor
Sounds wonderfully! However, is this possible for Melin to implement in a future FW?
 

RMerlin

Asuswrt-Merlin dev
Sounds wonderfully! However, is this possible for Melin to implement in a future FW?
To implement what? Everything described here is for Asuswrt-Merlin :)
 

Minglarn

Occasional Visitor
:D is it possible for you to make an extra settings-menu in your "official" FW?

This would be great for us who don't know how to use telnet and Linux :)
 
Last edited by a moderator:

RMerlin

Asuswrt-Merlin dev
:D is it possible for you to make an extra settings-menu in your "official" FW?

This would be great for us who don't know how to use telnet and Linux :)
An extra setting to do what exactly?

(PS: don't mind the edit notice on your post, the Edit button was too close to the Quote button here :) )
 

Minglarn

Occasional Visitor
An extra setting to do what exactly?

(PS: don't mind the edit notice on your post, the Edit button was too close to the Quote button here :) )
An extra setting to make the router send mail when it restarts ect. :)

Ps: sorry for my bad English. :)
 

RMerlin

Asuswrt-Merlin dev
An extra setting to make the router send mail when it restarts ect. :)

Ps: sorry for my bad English. :)
It's just a few lines of script, and it can't be built-in anyway because you have to configure a lot of parameters to match your specific setup (SMTP, authentication, etc...). It's way faster and simpler to implement as a user script than a built-in function. No point in replacing 10 lines of script with 40 lines of HTML and 50 lines of C code.
 

Builder71

Very Senior Member
I love scripts. :D
Would it be possible to alter it a bit and send an e-mail when this line is seen?

Jan 1 01:00:15 WAN Connection: WAN was restored.

This way I know the WAN has been down for whatever reason. :mad:
 

RMerlin

Asuswrt-Merlin dev
I love scripts. :D
Would it be possible to alter it a bit and send an e-mail when this line is seen?

Jan 1 01:00:15 WAN Connection: WAN was restored.

This way I know the WAN has been down for whatever reason. :mad:
Why parse syslog? wan-start gets run whenever the WAN interface comes up, that would be far more efficient.
 

Latest threads

Sign Up For SNBForums Daily Digest

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