Page 1 of 2

E mail from the developer

Posted: Thu Feb 16, 2023 8:01 pm
by simon-sandtcontrols
Hi All,

I wonder if anyone can help or point me in the right direction please, I could do with sending an E mail from an app developer app when certain conditions are met. I have no idea where to start.

I did try a search of this forum and hit a blank, so I don't think this has been looked into before, but please correct me if I have missed something.

Many Thanks.

Simon.

Re: E mail from the developer

Posted: Thu Feb 16, 2023 8:54 pm
by mnfisher
There is an easy way to do it - though a bit of a cheat - and that is to write a Python script and then execute this using ShellExecute. See https://automatetheboringstuff.com/2e/chapter18/

It would also be possible using the NetworkComms component and using Send to 'access' commands using a web-based email

Martin

Re: E mail from the developer

Posted: Thu Feb 16, 2023 9:15 pm
by simon-sandtcontrols
Thanks Martin,

This is going to be a bit of a learning curve for me, TBH I didn't realise you could run Python script in Windows, I don't think I have ever given it a thought.

I will need to sit down and carefully read through the link.

Simon.

Re: E mail from the developer

Posted: Fri Feb 17, 2023 7:57 am
by mnfisher
The examples in AutomateTheBoringStuff should get you going...

A couple of things -
You'll need to install python (if you've installed the esp32 toolchain then done:-) ) Get Python 3
add #!python3 as the first line of your python script then you can just run 'script.py' rather than needing 'python script.py'
You can test scripts from the command line - in the simple example below 'execute.py 10 hello' - will print 'hello' 10 times and then wait for a key.
ShellExecute in FC doesn't wait for the program to finish (this would maybe be nice as a parameter?)

Save as execute.py

Code: Select all

#!python3

from sys import argv

if len(argv) >= 3:
    print("Hello from " + argv[0])
    for i in range(int(argv[1])):
        print(argv[2])
print("Done")
input("Press Enter to continue")
                   
test exec.fcsx
(7.5 KiB) Downloaded 125 times
Note that I had my python script saved to ramdisk (r:\) - adjust the path as needed..

Martin

Re: E mail from the developer

Posted: Fri Feb 17, 2023 10:55 pm
by chipfryer27
Hi

Another possibility could be to use a third-party service such as PushingBox to send an email. The email recipients and content are preassigned to an API key, and upon receipt of such it sends out the email.

Regards

Re: E mail from the developer

Posted: Sat Feb 18, 2023 8:06 pm
by simon-sandtcontrols
Thanks guys,

Sorry for the late reply, work has got in the way. I will sit down in the evenings next week and have a look at both options, I am guessing the 3rd party option may have a cost to it, which I am trying to avoid, this is for a community radio station, that is completely run by volunteers (including me) and money is always tight. I am also slightly cautious about having to load additional bits of software, the PC's we initially need this for are our playlist machines and we try and keep software to a bear minimum on them.

I guess I was hoping it could all be done in app developer, so I could just generate an execute file , but it sounds like it's going to be more of a challenge than that.

I will post up the outcome when I have sorted it.

Re: E mail from the developer

Posted: Sat Feb 18, 2023 11:12 pm
by chipfryer27
Hi

PushingBox is free up to a certain limit and is quite a handy service.

Regards

Re: E mail from the developer

Posted: Sun Feb 19, 2023 8:41 am
by mnfisher
I wasn't aware of PushingBox but looks good and easy to use..

I tend not to use 'external' services if I can help it - they can disappear or start charging - but pick well and it can certainly save a lot of time..

It is also possible to use Powershell - https://www.google.com/amp/s/www.howtog ... tware/amp/ which would require no extra software... Again you'd use ShellExecute to run...

Martin

Re: E mail from the developer

Posted: Sun Feb 19, 2023 8:58 am
by simon-sandtcontrols
Ok thanks,

This might be my simpler option. I am not exactly conversant with Python. It will probably only send an e mail once every few weeks anyway.

Simon.

Re: E mail from the developer

Posted: Sun Feb 19, 2023 11:31 am
by chipfryer27
Hi

I agree with Martin that external services can disappear, certain Google ones did so, and you don't get much bigger than them. PB does seem well supported and is constantly adding features. I've been using it to send preformatted "Alert" emails since around 2015 or thereabouts, as cell reception in the target area was hopeless. Nothing too important, just warnings of levels meeting certain criteria. Emails were being checked multiple times each day by various people in the "to" list so someone would receive and action.

If in service range I've found their Push service to be fast and reliable on any android I've used.

Regards