E mail from the developer

Discuss PC Developer and Web Developer projects and features here.
simon-sandtcontrols
Posts: 19
http://meble-kuchenne.info.pl
Joined: Sun Mar 21, 2021 3:56 pm
Has thanked: 1 time
Been thanked: 3 times

E mail from the developer

Post 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.

mnfisher
Valued Contributor
Posts: 955
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 104 times
Been thanked: 508 times

Re: E mail from the developer

Post 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

simon-sandtcontrols
Posts: 19
Joined: Sun Mar 21, 2021 3:56 pm
Has thanked: 1 time
Been thanked: 3 times

Re: E mail from the developer

Post 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.

mnfisher
Valued Contributor
Posts: 955
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 104 times
Been thanked: 508 times

Re: E mail from the developer

Post 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 114 times
Note that I had my python script saved to ramdisk (r:\) - adjust the path as needed..

Martin

chipfryer27
Valued Contributor
Posts: 1147
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 285 times
Been thanked: 412 times

Re: E mail from the developer

Post 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

simon-sandtcontrols
Posts: 19
Joined: Sun Mar 21, 2021 3:56 pm
Has thanked: 1 time
Been thanked: 3 times

Re: E mail from the developer

Post 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.

chipfryer27
Valued Contributor
Posts: 1147
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 285 times
Been thanked: 412 times

Re: E mail from the developer

Post by chipfryer27 »

Hi

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

Regards

mnfisher
Valued Contributor
Posts: 955
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 104 times
Been thanked: 508 times

Re: E mail from the developer

Post 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

simon-sandtcontrols
Posts: 19
Joined: Sun Mar 21, 2021 3:56 pm
Has thanked: 1 time
Been thanked: 3 times

Re: E mail from the developer

Post 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.

chipfryer27
Valued Contributor
Posts: 1147
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 285 times
Been thanked: 412 times

Re: E mail from the developer

Post 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

Post Reply