cancel
Showing results for 
Search instead for 
Did you mean: 

Arduino Emailer

FIXED
deepvalley
Hooked
Posts: 8
Registered: ‎25-08-2021

Arduino Emailer

This is quite a specific question and can probably only be answered by a plusnet techy, I've programmed an arduino to extract the external ip address from an email header and then email that ip address to me if it changes, my question is, is there an acceptable usage limit to the number of times in a certain period I can hit the plusnet mail server for this information, at the moment it's set to check every hour, but I could conceivably set it to check ever 5 minutes.

28 REPLIES 28
dvorak
Moderator
Moderator
Posts: 26,559
Thanks: 5,141
Fixes: 1,291
Registered: ‎11-01-2008

Re: Arduino Emailer


Moderators Note


This topic has been moved from General Chat to eMail

Customer / Moderator
If it helped click the thumb
If it fixed it click 'This fixed my problem'
7up
Community Veteran
Posts: 15,556
Thanks: 253
Fixes: 17
Registered: ‎01-08-2007

Re: Arduino Emailer

@deepvalley I'm not sure if i'm possibly talking to a spammer but..

I've sent hundred / thousands of emails through PNs servers to my own mail server (testing purposes) in the past. I did so by asking them first (via this forum) and they said the server could take it and should be okay.

Sure enough i repeatedly sent loads of mail out through it which it then sent back to my local server. I really did put a lot more mail through it than your arduino will.

Best bet is to bring @bobpullen into this - he can check your ISP account and keep an eye / let you know if it's still okay. I've been with PN for well over a decade so they kinda know what i'm like but they might still need to clarify your intents to check you're not a spammer.

I need a new signature... i'm bored of the old one!
deepvalley
Hooked
Posts: 8
Registered: ‎25-08-2021

Re: Arduino Emailer

Thanks for your input, definitely not a spammer, I just need notification of an external IP change so I can update my cctv viewing software so I can view them on my mobile,  I probably don't need to check the server more than once every hour so effectively 24 emails in any 24 hour period isn't excessive although it would be every day.

Den1
Rising Star
Posts: 149
Thanks: 9
Fixes: 2
Registered: ‎24-10-2013

Re: Arduino Emailer

Would a static ip be a better idea ?  you would need to hit the mail servers pretty hard to be noticed, one email every hour won't be a problem 

deepvalley
Hooked
Posts: 8
Registered: ‎25-08-2021

Re: Arduino Emailer

Yes.....that would be ideal but I've tried that with plusnet and I didn't have broadband access for 3 days until they switched me back to a dynamic address.  It worked fine on a plusnet router but despite getting 3 techies involved and I'm no thicko in the techy department myself I couldn't get it to connect to my tplink router and I need the tplink device because that gives me full control for port forwarding and the blocking of specific ports.

pjmarsh
Superuser
Superuser
Posts: 3,403
Thanks: 1,081
Fixes: 9
Registered: ‎06-04-2007

Re: Arduino Emailer

That sounds odd.  I've never heard of anything like that before.  There aren't any changes needed at your side for a static IP, neither would your router know if its static or dynamic.  It's just the address that Plusnet send you when connecting

Superusers are not staff, but they do have a direct line of communication into the business in order to raise issues, concerns and feedback from the community.

deepvalley
Hooked
Posts: 8
Registered: ‎25-08-2021

Re: Arduino Emailer

Yes that's what I thought, tried everything, even doing a factory reset of my router, nothing seemed to work, internal network access was all fine just wasn't connecting to plusnet, as soon as the dynamic address came back it connected fine, all very odd.  Nothing's ever easy.🤪 that's why I built the arduino thing and that wasn't easy either🤣

7up
Community Veteran
Posts: 15,556
Thanks: 253
Fixes: 17
Registered: ‎01-08-2007

Re: Arduino Emailer

Sounds to me like they had an internal IP configuration problem at their end not yours.

Anyway your email will be fine at one each hour lol. I was sending hundreds per minute - though as previously mentioned they didn't leave the PN network, they just bounced back to my mail server.

I'm curious about your setup though and why you're using an arduino to read and parse an email for an IP address? - not quite seeing how that fits in with a CCTV setup.. why not a Raspberry Pi instead?

I need a new signature... i'm bored of the old one!
deepvalley
Hooked
Posts: 8
Registered: ‎25-08-2021

Re: Arduino Emailer

A pi seemed a bit overkill and power hungry although it would probably have been easier, although arduino has a nice ide that I can use at work and at home, which leads me to my next reason.....I needed a meaty project to get my teeth into so I can get up to speed with using arduino for work.  To be honest I could have gone down the "no-ip" route, but I prefer to keep things in-house where I can control them, rather than using someone else's system which is why I didn't extract the ip from a website like "whatsmyip....., I know PN servers are someone else's system but I am paying for it so thought I would exploit it.

Now onto my system..... to view my cctv cameras remotely I need the external ip address, which occasionally changes due to power failures or just because PN decides it wants to change it,  once I have that ip address I can plumb that into my camera app on my phone, my home router does the port forwarding and I have access to the cameras.

In reality I could hit the PN email servers every millisecond with the arduino, which would really be overkill and I suspect that would almost appear as a DoS request which may raise a few eyebrows at PN HQ, I'm debating whether every hour is necessary really as I certainly don't need an update check every hour in the middle of the night unless I want access to my cctv from the other side of the planet.😁 I have been experimenting with a gsm module which is an option.....if I find the ip has changed I make a call to gsm module attached to the arduino and it emails me the ip instead.

7up
Community Veteran
Posts: 15,556
Thanks: 253
Fixes: 17
Registered: ‎01-08-2007

Re: Arduino Emailer

But what is the arduino doing? - Is it sending mail to your PN accound and then downloading it to find the IP? - You said you're using it to get the IP from an email... so if the arduino is sending and downloading that's clever.. if not, what is it doing exactly and where does the email it's parsing come from in the first place?

Periodically i do a google search for sites that offer your IP address as plain text. Some drop offline, then new ones pop up. I have my own dynamic dns updater which checks every 30 seconds for a change in IP address - it uses each site one by one in round robin style so that i don't put too much traffic on any of them / get banned. 

I need a new signature... i'm bored of the old one!
deepvalley
Hooked
Posts: 8
Registered: ‎25-08-2021

Re: Arduino Emailer

oh OK sorry didn't realise you were after specifics of the arduino program.  The arduino sends a "ehlo" message in plain text to the PN servers on port 25, those servers respond with a raft of standard smtp data which includes the external ip address that the original message was sent from enclosed in square brackets, the arduino reads this data a bit (computer bit) at a time, when it detects an open square bracket it adds the characters into a string array until the closing bracket is detected, the arduino then effectively sends another ehlo message to the servers this time in a standard message format which includes the string array containing the ip address.  The arduino although it's only a dumb PLC is quite a powerful little device really, I'm using an ethernet shield with a standard uno but i could do it with the arduino nano iot which is a 2"x1/2" WiFi device.

7up
Community Veteran
Posts: 15,556
Thanks: 253
Fixes: 17
Registered: ‎01-08-2007

Re: Arduino Emailer

Yeah i know what the nano is lol.. got a few stashed here along with a mega 2560.. I tried using one years ago to replace a dead vehicle cooling controller that had led to a head gasket failure but it didn't work out so well - wasn't fast enough I think (truth be told i never really knew as without a scope on the sensor wire i wasn't sure if it was an analogue voltage coming out or a pulsed signal). It did work for switching the fans on / off and i had both hi and lo speeds working but it was just flaky at reading the data from the temperature sensor. Truth be told i waste too much of my time on code (and general internetting) rather than getting any electronic stuff done and now that you can pick up scopes for almost peanuts there's no excuse for me not doing more. I've been wanting to make a UV exposure / etching setup for a while to make my own PCBs too as i don't like breadboards much and find them too time consuming. That's something that's held me back for a while..

The EHLO useage is a clever trick. I'd not thought of that (or realised that it would return the IP of the sender - and i've been writing mail, dns and dhcp servers lol) but i certainly like it and potentially opens you up to thousands of servers to obtain your IP from instead of just a few that i know of via http. I might give that a go myself at some point. What i would say though is if you sign up over at freedns.afraid.org you can get a free subdomain which you can use as a dynamic DNS address and your arduino via the ethernet could send a http request fo update your domain when it finds an ip change. FreeDNS has been going well over a decade and is very reliable - i've got multiple subdomains hosted there and never had a single failure. You could then continue to use your ip by email system at the same time so you have a fail safe should one method not work for some reason.

Enjoyed this topic, been a hoot!

I need a new signature... i'm bored of the old one!
deepvalley
Hooked
Posts: 8
Registered: ‎25-08-2021

Re: Arduino Emailer

I've only recently started using the arduino platform properly, although I've been trying to get to grips with it for 2 years. I've always been able to use picaxe for my projects before, the simplicity of its coding structure makes knocking up a little device really quick but it's not powerful enough for this project.  I really like the iot for being able to just plug it into a USB slot and you have a fully functioning WiFi server right there in a simple relatively cheap package.

I know what you mean about breadboard, it's an alien and very flaky way of building if you ask me I much prefer to produce my own pcb's,  I've got a uv etching setup at work, although if I just want to do a quick one off project I sometimes use veroboard now, as I can't justify the time required to produce the artwork.

The point you made in your last over about http sites coming and going is what led me to build this arduino project, (keep calling it a project when all it is a program in an arduino is a bit of a strange concept for me).  I never really considered probing other mail servers with this arduino, I presume they encapsulate the ip in the same way in all systems.  A failsafe isn't something I'd considered really it's not a matter of international concern whether my cameras are viewable twas just a "little" project I've wanted to produce for a while.  I'll have a look at that freedns site as it was an option I had considered early on in the development of this board.

Mook
Champion
Posts: 909
Thanks: 195
Fixes: 2
Registered: ‎27-12-2019

Re: Arduino Emailer

If you have access to dig you can use the following to capture your IP.

dig +short myip.opendns.com @resolver1.opendns.com