Sending mail by pushing a button through ifttt

can we use pushbutton or toggle switch instead of the pir sensor we have used in the tutorials for ifttt. i have to send an email when i push a button connected to pin 4 on bolt kit. i have to add this feature in my final year project so please d help.

I suggest you to use Mail Gun and Bolt APIs to send the mail instead of IFTTT. Here is the link to Mail Gun: https://www.mailgun.com/

Hi,
You can use MailGun as PPV have suggested. First, verify your domain on mailgun and after verification, you will get an API key from mailgun.

Refer this python code snippet.

import json
import time
import requests

def send_simple_mail():
    return requests.post(
        "https://api.mailgun.net/v3/samples.mailgun.org/messages",
        auth=("api", "key-3ax6xnjp29jd6fds4gc373sgvjxteol0"),
        data={"from": "Excited User <excited@samples.mailgun.org>",
              "to": ["devs@mailgun.net"],
              "subject": "Hello",
              "text": "Testing some Mailgun awesomeness!"})

while True:
        time.sleep(5)
        # Replace api_key with your api key that you will get from bolt cloud
        # Replace device_name with your original device name
        response = requests.get('http://cloud.boltiot.com/remote/api_key/analogRead?pin=A0&deviceName=device_name')
        data = json.loads(response.text)
        if data['value'] > 10:
                print  "temperature is=", data['value']
                print "sending sms"
                send_simple_mail()
        else:
                print  "temperature is=", data['value']
            print "temperature is normal"
1 Like

thank you sir !! The bolt is not taking the input from push button , i have used pull up configuration. is there anything else i have to add in the code to make it working.

Hi please share your code here as well