Control Email using IFTTT

Hi

I have read the following thread:

and am struggling getting to this to work using Thunkable X Cross Platform and would like to know if this is the only way to send an email from ios and Android without it opening the email app.

My issue is that when I created the account in the IFTTT site it did not give me any “key” that is mentioned in this tutorial (very good guide though) and I do not see to be able to see the same blocks used here either.

I would appreciate any help with this please

Thank you

TimCS

1 Like

Hi there,

The Web API component in X has slightly different blocks to the Classic Web API component.

The blocks from the Web API docs show how to display the response:

It takes slightly different steps to get to the Webhooks page of IFTTT, but you can see it at that link.

Hi Jane,

Thank you for your reply. Sorry for being dumb as you probably can tell I am new to Thunkable (although I have coded in other languages) and am trying to understand your post on where the example you provided ties in with the guide from my link.

Also (I know this is IFTTT) the guide mentions about a key that IFTTT provide but when I set up this email webhook on their site, no key was provided. Have IFTTT changed this or have I set up the email webhook incorrectly ?

I am surprised however that Thunkable does not have a built in way of allowing an app to send an email without the use of 3rd party interfaces or am I missing something here? I did see a couple of plugins mentioned but I suspect that these are at a price (well the first one is anyway)?:

This also mentions another one called sendmail and the link to this site seems to mention various ways about this, is this correct? do these work with X cross platform?

Thanks

TimCS

Hi @appdevelopertcs and sorry for the delay in answer. Yes, IFTTT is changed since I wrote my tutorial and I’m not aware about new procedures to use it. I’m sorry I’m not able to help you.

1 Like

Hi @giorgiospugnesi thank you for your reply . Your guide was very useful even though IFTTT have changed their systems and/or procedures.

My main goal within the app I am making is to be able to send emails without opening the mail app on the device (this app will have to work for both Android and iOS) do you know of another way around this or perhaps a plugin ?

Thanks

TimCS

The first thing that comes to my mind may be arranging a web host that exposes some API.
You can call that API with some parameters and let API send email. You have to protect API to avoid be called outside yor app but there are many ways to do it.
Maybe a free hosting plan could work for you.

Thanks @giorgiospugnesi for this I do have a web space hosting plan with email accounts it’s more of a share hosting would this work and what would I need to check to know it will work for this. Excuse my ignorance I’m new to thunkable

Thanks

TimCS

Does your web host support some programming language, like PHP?
Try to write a page that send and email when loaded.
In PHP you could write a page like this:

<? mail("to@email.com", "Test", "Test") ?>

(using your email instead of to@email.com)
save it as test.php, put it on server and call it using http://youthost/test.php

If you receive an email, all it’s ok and you can go head writing the right code.
It’s a good idea use a secret token as parameter in order to avoid sending email when someone call the page. Only call by you app should send email.

Then call that page from your Thunkable app (search documentation about how to call a web page or API) passing the right parameters.

Hope it helps!

Hi @giorgiospugnesi thank you for this yes I have written some php before on my web site hosting and run it via an URL so this sounds like it will work not sure how to apply a secret token though but again thank you

TimCS

May I ask what the purpose of this is? It is generally a bad idea to send emails from an app without going through the user’s email app, as this is potentially a mechanism for phishing and other malware.

-Mark

Hi @Mark I am writing an app , really don’t want to give the idea out here, that at the moment will only be used by a selected group of people friends and family so there is no malware intentions.

Thanks
TimCS

The easiest way (but less safe) is put the same “complex” string (i.e. a Guid) both in app and in PHP code. When app calls page, send that string as parameter and the page check if it’s correct.
Someone could sniff that parameters, so it’s not bulletproof but it’s a first, basic, protection.
Other solution may (and should) be implemented but just for try, go for it.

Thanks @giorgiospugnesi , I have been testing the email part first and although I got it to send two emails to start with, it appears now to have stopped working altogether. I noticed from your example that you did not state <?php then close it with the ?> so I tried that and it seemed to have worked. However since then I tried the mail command with and without using variables to hold the messages, subject etc and it has stopped sending emails and so I checked the spam engine with my web space and the spam folder of the receiving email address and I do not see any issues.

Any thoughts to why this would have stopped?

Thanks

TimCS

I’m interested in this kind of things as I will probably need it (I’m italian too btw as I suppose you are),

I wanted to implement something similar for security purposes but right now I’m going with the e-mail firebase sign- in which should be safe

Depending on PHP settings, both could works.

[quote=“appdevelopertcs, post:13, topic:184230”]Any thoughts to why this would have
stopped?
[/quote]

Check hostin rules. Maybe it does’n allow relay or you need to send email using authentication.
Take a look here, too: https://www.php.net/manual/en/function.mail.php

Using a database to store information for security purpose it’s a good idea. You could store phone’s IMEI or Number in order to identify sender.
I don’t know @appdevelopertcs has a DB in his hosting plan.

Hi @giorgiospugnesi when I have tried testing this further it appears that it works with my web hosting domain email address but when I send it to my gmail it appears to have worked to start with and then stopped. Would Gmail be blocking this? the first two times worked however?

Thanks

TimCS

@giorgiospugnesi I can create databases on my hosting through mysql, would this work through firebase and how involved is this to use?

Thanks

TimCS

@appdevelopertcs database, in your scenario, could be useful to store users authorized to send email (instead of the “secret token”).
Maybe Gmail considers your messages as span.
Maybe your host permits only “internal” email (not relay to other domains).
Try to put some code in your page that output sendig result

<?php mail("to@email.com", "Test", "Test") or die("Unable to send email") ?>

I wanted to authenticate the user trough an SMS OTP but (excluding that I can’t cause thunkable does not allow that with firebase) I had the app send secret informations as SMS sending service address and password so I thought to let a site do that, I don’t know how security works