Sending an email programmatically without user intervention from within an App Inventor app is no simple task. There are different solutions available, but these are more advanced solutions, because these require setting up a PHP server.
The solution presented here is very easy and you can set this up in 15 minutes only.
Note: Meanwhile there also exists another even simpler solution, which does not need any setup. You now can use the mail extension to send an email via SMTP programmatically without user intervention to several To, Cc or Bcc addresses, add several attachments and send in plain text or HTML format.
What is App Inventor?App Inventor is a graphical programming environment for making Android apps. It creates Google Play-ready apk files (not Java code) directly.
Prerequisites- IFTTT Account
- App Inventor account
- Android device
- Go to https://ifttt.com/maker_webhooks
- Click "Documentation"
- Copy your key to use in your App Inventor app
- Go to https://ifttt.com/
- Click "Home", then "+ Create"
- Click "If This", click "Add", then
- a) search for the "Webhooks" service
- b) Click "Receive a web request"
- c) Name the event "Sendmail", click "Create trigger"
- Click "Then That" , click "Add", then
- a) Search for service "Gmail", then select "Gmail"
- b) Choose "Send an email"
- c) in the To Address textbox add {{Value1}}, in the Subject textbox add {{Value2}} and in the Body textbox add {{Value3}} and click "Create action"
- Click "Continue", check your recipe, optionally enable "Receive notifications when this Appket runs" and click "Finish"
- Ready!
- Download the example project (aia file) from here
- Upload the example project (aia file) into MIT App Inventor
- In the blocks editor, add your key from Step 1 above.
- Test your project: Add a To Address, a Subject and a Body (you also can use HTML tags) and click "Send"
- The result "Congratulations! You've fired the Sendmail event" will be displayed after sending the email successfully.
In the IFTTT Recipe, there are 3 values you can use. In the example above, I use these values for To Address, Subject and Body. To send an attachment, first upload your attachment to the internet, for example to your Google Drive or your web server. Then replace one of the values by the link to the attachment.
Further PossibilitiesUse other channels to trigger something else, for example toggle your WeMo Switch, or... (endless possibilities)...
Woo Hoo!Enjoy!
Taifun, puravidaapps.com
(last update 2020-Dec-03)
Comments