What's new

[WICENS] WAN IP Change Email Notification Script

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

Fixed 3.11 Use option F to update

Please run another test and let me know, thanks
 
Thanks for the quick action.

Code:
[ OK ] Internet check                   : 6 successful pings, appears up
[ OK ] Done sending Email message 1 of 1
[ OK ] Script completed.

So the mail gets send now, which is already a big improvement. One remark though: it's still not using the From Mail address that amtm uses. It's using my username required to login tot iClouds' smtp-server and not the alias I specifically created for my router. So you are using a valid e-mail address now (username @ domain) but not the alias of the notifications mailed by the router.

Code:
> MAIL FROM:<wouldntyouliketoknow@mac.com> SIZE=657

instead of wouldntyouliketoknow@icloud.com.

I have rules configured that if the alias I created for my router is recognised as sender of the received mails, I get notified immediately. If WICENS ignores that alias and uses the user name instead, they will just be received as ever other mail. Not a huge deal breaker, but it would be nice to have if the mail config amtm uses for Diversion, Jacks' scripts etc. would be used consistently, so I recognize the mails by the sound and receive a seperate push notification if somethings' up concering my network.

Looking at the code in email.mod from in \jffs\local\amtm your mixing up FROM_ADDRESS and USERNAME in \jffs\scripts\wicens.sh

Code:
        # write AMTM config to wicens
        F_replace_var user_from_addr "$USERNAME" "$config_src"
        F_terminal_check_ok "Imported send from/login address - $USERNAME"

Hope this helps? Thanks again for your effort.

Best regards,
Marco
 
Forgive the newbness of my coding ;)

wicens started out as a 20 line script for personal use and grew to what it is now and I still have extremely limited knowledge around sendmail/curl/mime formatting

Ill look at getting this fixed but will require more than a one line edit
 
Forgive the newbness of my coding ;)

wicens started out as a 20 line script for personal use and grew to what it is now and I still have extremely limited knowledge around sendmail/curl/mime formatting

Ill look at getting this fixed but will require more than a one line edit
No problem, take your time. I can’t code at all. Looking forward to your findings.
 
Forgive the newbness of my coding ;)

wicens started out as a 20 line script for personal use and grew to what it is now and I still have extremely limited knowledge around sendmail/curl/mime formatting

Ill look at getting this fixed but will require more than a one line edit
At this stage it would be much simpler to use amtm mail settings directly instead f importing, just as I originally suggested.
 
@ImGettingTooOldForThis you're right I had them mixed and I had bad syntax in the mail header

3.20 is up
  • CHANGED: revert 3.11 to 3.10
  • CHANGED: Email message 'from name' (6 in edit) changed to Email 'from address' (proper Email header)
  • CHANGED: Email 'from name' changed to 'wicens script' for Email header
  • ADDED: Email 'send to name' set to 'wicens user'
  • ADDED: Email 'send to name' and 'send to address' now in Email header
  • FIXED: custom script entry time var left in config when exiting script path entry
  • FIXED: misc script house keeping
  • INFO: amtm import will not import amtm FRIENDLY_ROUTER_NAME(unused msg text) and TO_NAME(hard coded to wicens user) variables
Let me know if this works out for you, thanks
 
And a troubleshooting tidbit, whenever you have sending errors or aren't receiving sent messages always just check your sending server status..... Im about to get 40 Emails when they come back up

microsoft outage.JPG
 
I think? the recent changes break compatibility with GMX.com's service. You get a 554 error and a link with more info, which states (machine-translated from German):

E-mails are rejected by our mail system if the information given in the e-mail header does not comply with the specifications in RFC 5321 and RFC 5322.

This includes the following points:
  • The following headers must be syntactically correct: Date, From, Sender, To
  • The headers BCC, CC, Date, From, Sender, Subject and To must not occur more than once
Usually in these cases there is a syntax error with an e-mail address that was specified in the From or To field. A common cause is, for example, unencoded umlauts or semicolons instead of commas when specifying multiple addresses.

Therefore, please check the information provided by your system for correctness and, if necessary, contact the administrator of your system.

Notably, amtm/diversion (whose email I settings I set up after I did those in wicens) works fine. (I'm not sure how to get a complete log from the diversion email test, unfortunately.) I then tried setting wicens to just sync the settings from amtm, but got the same error (though the login method was slightly different--it appears to have used sendmail when manually configured and curl when the settings are synced from amtm, even though both appear to use STARTTLS). Manually redacted logs from both attempts are attached. The only thing that stood out to me though were these lines from the sendmail log:

Code:
sendmail: send:'RCPT TO:<to-email@redact.ed>'
sendmail: recv:'250 OK'
sendmail: send:'RCPT TO:<to-email@redact.ed>'
sendmail: recv:'250 OK'

Since it looks like having set TO twice might? be the issue, based on the second bullet-point above. That said curl does not seem? to set this twice, and yet fails with the same error, so I'm really not sure what wicens is doing differently from amtm/diversion such that it rejects its emails.

(I am realizing this is my first actual post here after maybe a decade or more of lurking--I don't want this to come across as whiny or entitled, and really appreciate all the great work done here on the asuswrt ecosystem as well as the community more generally, cheers all!)
 

Attachments

  • wicens_test_00__sendmail_REDACTED.log.txt
    2.7 KB · Views: 30
  • wicens_test_01__curl__REDACTED.log.txt
    3.7 KB · Views: 25
Last edited:
I think? the recent changes break compatibility with GMX.com's service. You get a 554 error and a link with more info, which states (machine-translated from German):
Sorry to hear you're having troubles, if amtm is working please reset the wicens script and re-import. It should set curl as the sending command and it is the same as amtm. If success with amtm and fail in wicens my first guess would be the formatting of the date in the Email header not meeting RFC

Let me know if you're up for a couple experiments
 
Hmm, so I did try earlier to set it to use the amtm settings/curl and that didn't work. After resetting the script just now and trying again, I got the same error, and the log is basically identical to the second one attached to my earlier post. Any other ideas you have I'll try, I'll be up for a bit longer but if not then could probably get to it tomorrow
 

Attachments

  • wicens_test_02__curl__REDACTED.log.txt
    3.6 KB · Views: 28
Hmm, so I did try earlier to set it to use the amtm settings/curl and that didn't work. After resetting the script just now and trying again, I got the same error, and the log is basically identical to the second one attached to my earlier post. Any other ideas you have I'll try, I'll be up for a bit longer but if not then could probably get to it tomorrow
You can try and copy and paste this command which will replace the date command in the email message which Im guessing is the issue and then rerun the test

Code:
sed -i '1900s|^.*$|                echo "Date: $(/bin/date -R)"|' /jffs/scripts/wicens.sh

Otherwise maybe visit the postmaster site from your log and see if it describes the error in more detail, replace with your IP
Code:
554 For explanation visit https://postmaster.gmx.net/de/case?c=hi&i=ip&v=this.is.my.ipv4
 
You can try and copy and paste this command which will replace the date command in the email message which Im guessing is the issue and then rerun the test

Code:
sed -i '1900s|^.*$|                echo "Date: $(/bin/date -R)"|' /jffs/scripts/wicens.sh
Yup, that did it! Log was fine and I successfully received the email.

Otherwise maybe visit the postmaster site from your log and see if it describes the error in more detail, replace with your IP
Code:
554 For explanation visit https://postmaster.gmx.net/de/case?c=hi&i=ip&v=this.is.my.ipv4

(Not that it matters now but, sorry if this was unclear before--the message from the postmaster site mentioned in my log is the thing translated from German in quotes in my first post)
 
(Not that it matters now but, sorry if this was unclear before--the message from the postmaster site mentioned in my log is the thing translated from German in quotes in my first post)
Sorry I overlooked the part where you mentioned about the link, its the same text on their website.

Yup, that did it! Log was fine and I successfully received the email.
Excellent, just don't update or reinstall and it will continue working. Ill push an update in the next day or two to make it permanent along with a fix for Sunday logging which I borked in the move from V2.85 -> V3.XX

I've learned a lot more in the last few days thanks for the feedback from those using this script.
 
Sorry I overlooked the part where you mentioned about the link, its the same text on their website.
Ah ok great, water under bridge
Excellent, just don't update or reinstall and it will continue working. Ill push an update in the next day or two to make it permanent along with a fix for Sunday logging which I borked in the move from V2.85 -> V3.XX
Mmm will do, actually now that I know a bit more about how the script works/is structured I'll probably begin poking around in there, haha
I've learned a lot more in the last few days thanks for the feedback from those using this script.
The best feeling, glad to contribute a bit to that!
 
3.30
* FIX: Sunday logging broken since 2.85
* FIX: date in Email message not RFC compliant (rejected by some servers)
* CHANGED: removed changelog duplication during update installation
* CHANGED: misc wording

Mmm will do, actually now that I know a bit more about how the script works/is structured I'll probably begin poking around in there, haha

The best feeling, glad to contribute a bit to that!
Please do, let me know if you see anywhere for improvement. I intended for this to work for everyone and be user friendly hence why after all this time I still put effort into it when I can, Im decently good with computers not a coder. Thanks to @thelonelycoder for inclusion in amtm which has helped it reach a wider base and can be useful to those who use it. Its arguably one of the most simplistic in function scripts (wildly overwriten) but knowing people can find it useful is cool.

Im contemplating starting v4 with telegram and pushover as options and rewriting the function through and through again, we'll see what life throws my way
 
Hi everyone I got an issue it’s not sending a test email how do I fix?
 

Attachments

  • 0E550DE8-B2E4-4965-B88A-9FBF8134EBBD.png
    0E550DE8-B2E4-4965-B88A-9FBF8134EBBD.png
    141.3 KB · Views: 28
  • 39EF121B-9276-475C-9F69-A9457FD117B8.png
    39EF121B-9276-475C-9F69-A9457FD117B8.png
    137.7 KB · Views: 28
Guessing the 535 is indicating your credentials are incorrect.

Ensure in Email edit menu (Main Menu 1), options 5 & 6 are the same Email login/from address and use option P in the main menu to re-enter your Email password.

You can also try configuring amtm Email and testing with it and if it works there use the import option

If you're using something like GMail you MUST enable 2 Factor Authentication and create a specific password for this script, or if the option exists with your Email provider enable 'Less Secure App' access
 
Guessing the 535 is indicating your credentials are incorrect.

Ensure in Email edit menu (Main Menu 1), options 5 & 6 are the same Email login/from address and use option P in the main menu to re-enter your Email password.

You can also try configuring amtm Email and testing with it and if it works there use the import option

If you're using something like GMail you MUST enable 2 Factor Authentication and create a specific password for this script, or if the option exists with your Email provider enable 'Less Secure App' access
I’m using aol.com
 
Says it’s bad auth, login denied however I’m entering the right credentials
 

Similar threads

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!
Top