Sending commands via email to Arduino

Hi,

Apologies if this has already been discussed somewhere else...

I work with a robot that can send emails if it fails or finishes a process and I'd like to use this to enable a LED to come on once the email has been sent. I know that I can make an LED come on if I receive emails, but not sure if it's possible to tell Arduino to light up if sent a message ONLY from this email address. I'm even more unsure whether I can assign different colours to different emails, ie, green light for process complete email, red light for failed process etc.

Also this unit would need to be portable, so not really ideal if connected to USB.

Is this possible?

Many thanks,
Kelvin

Emails can take hours to days to be delivered. Is time of some importance to you?

Paul

Besides Paul's point, which I share, I'm curious how this robot is able to send emails but has no onboard indicators, such as LEDs of its current operating state. I guess the robot is internet connected. Can you program the robot? Does it output its status in any other format besides sending emails?

Certainly possible - with the observations above.
Just like parsing an incoming SMS message, you need to separate the incoming messages with the standard c-string functions, then perform what you want to do.

In my code - I separate the 'words' in the commands with strtok() into a number of parameters px*.

p0 is the command
p1 is the object of the command
p2 is the action to be performed
p3... are optional parameters that are used by p1 & p2

e.g. CAR LEFT 20
or SET MOTOR STOP
or SET TIMEOUT 2000
or TURN LIGHTS ON

You can do whatever you like with this idea - even improve on it... !
Note the position of TURN means it is interpreted differently based on whether it is p0, p1, p2... etc

I'm confused as to what is sending emails now. The robot? Which is based on Arduino or something else?

Sending an email is relatively easy. Just connect to a mail server and send a simple piece of text that has to, from, subject and whatever.

Receiving an email is much more complex. You connect to your mailbox, get the list of unread messages, request to read one of those messages, then you can read what is in the message. The mailbox might be Hotmail, gmail or whatever but it requires a lot more back-and-forth request-response stuff.

Maybe a "bigger" computer like a Rasberry Pi will make that part easier.

You could use an ESP based board like nodemcu (https://www.ebay.com/itm/254124923431) instead of arduino. They are much cheaper than raspberry pi. You wont get full blown email capabilities but I think you could just send/receive emails using gmail. Here are some links to get you started

Hi All,
Thanks for all your replies, it's given me a lot to think about. I'm new to Arduino (any programming for that matter) and thought that making some lights flash might be a good place to ease into it - looks like I may have been wrong adding the email part.
To elaborate a bit more, the robot I work with is not Arduino but from a company called Hamilton Robotics.
To answer liuzengqiang's question about alerting a user other than email, it will prompt via a PC screen connected to the robot - so a remote alert would be really handy. It may have other ways to alert a user who is not stood directly next to it - I will have to look into that - but I know that it has the ability to ping an email with said alerts.
I think that I might be asking the impossible, as even if the robot does send an email, there's no way for Rasberry Pi, or nodemcu, or Arduino to know what that message says, am I right in thinking this?
If I moved away from the email idea and could, say, connect to the robot PC via wifi - would this be a better, quicker route to sending an alert?
My beginner's brain is telling me that if the robot sends - for example - an error message to a file on the PC that the Arduino/ Raspberry Pi (or nodemcu) can read from wirelessly, then that might be a better solution. If, of course, it's possible to push that information as soon as it's uploaded to the file...
Apologies for the ramblings, and thanks for the comments and suggestions

Connect to mail server - 3/4G, wifi or wired
Username & password
Collect any messages, delete from server
Sort/filter/ignore messages as preferred
— Parse the selected message content
— Act on the content.
— Repeat if needed for other messages that were received
Close connection to mail server

It’s fairly advanced, but not rocket science.
Maybe not a good first learning experience.

OP,

Maybe this is what you are looking for:
Problem: robot completes task/runs into trouble
Action: robot emails or texts someone
Issue: other people don't know the robot needs help because they didn't receive emails or texts

Is the above what you were dealing with?

Maybe add multiple recipients to email and text? Maybe have robot upload or update a file in a cloud storage that is shared among people that should pay attention. They will all see the update. You can also try thingspeak or other online platforms that offer data logging from sensors. You have robot send its latest status to a data stream. Everyone interested in this listens to the data stream and watch of errors.