Send an ESP32 Camera Photo by Email
Press a button, take a photo, and receive it by email. With Warblet's XIAO ESP32-S3 Sense demo, the camera uploads the picture and a routine handles the alert. You get a snapshot of the event without running a mail server on the board or a dashboard server at home.
The useful part is knowing which event the picture belongs to. This walkthrough starts with the camera's own button, then shows how a separate device or an image-capable agent can become part of the project.
Choose the camera this example uses
Use a Seeed Studio XIAO ESP32-S3 Sense with its camera board attached, the supplied Wi-Fi antenna, a USB-C data cable, and a 2.4 GHz Wi-Fi network. You also need a Warblet account and an alert email address set in its settings.
Follow the camera demo's installation instructions, including ESP-IDF 5.5 if building the firmware from source. The guide identifies the board, camera, pins, and setup steps. A different board carrying the ESP32 name may need different firmware.
Set the demo up through Warblet setup. The first setup adds the routine “Doorbell: email the photo” to your account, switched on. Open Routines and confirm it is present and assigned to the camera's spec.
Follow one press from the board to the inbox
- Let the board finish starting and connect to Wi-Fi. Press its BOOT button while it is running.
- Look for a new photo on the device page. The button-triggered message should carry the tag
press. - Check the routine's run log for an alert action with an
image/jpegattachment. - Check the destination inbox and compare the attachment with the scene you photographed.
Email alerts are off until you set an address in account settings. A routine editor dry run can show the attachment action without sending an email; use an actual button press to check delivery afterward.
Know which photos send email
The demo labels photos by what caused them. The supplied email routine uses that label:
| What triggered the photo | Message tag | Default email behavior |
|---|---|---|
| BOOT button or the external switch | press | Queues a photo email when the cooldown allows |
A snap command from Warblet | snap | Photo appears on the device page; no email from this routine |
| The regular five-minute report | heartbeat | Photo appears on the device page; no email from this routine |
There are two separate limits. The board ignores additional button-photo requests within 30 seconds. The email routine waits six minutes after queuing an alert before queuing another. A photo can therefore arrive on the device page without producing a new email. Other routines also share the account's ten-emails-per-hour allowance.
Attach the picture from this event
The published doorbell routine checks the tag and cooldown, then reads the triggering camera message with raw_latest(event["hw_id"]). It passes that photo to alert() as an attachment.
Use the complete routine when adapting it, including its missing-image check and cooldown. The important distinction is between the image that caused the routine to run and a photo you happen to have seen earlier.
To check freshness, change an obvious object in the frame between tests and wait for the cooldown. Compare the new device-page photo and the email attachment. This catches a stale-picture problem that a successful “email sent” message would miss.
Put the button where it belongs
Once the onboard button works, the demo also supports a switch between D0 and GND. Closing the switch takes a photo; holding it closed does not continually take more. The demo guide explains the wiring and door-contact behavior.
For a button on a separate board, use the two-device camera and email example. That example uses an Olimex button board and a Freenove camera in the same Warblet account: one routine sends snap, and the other emails frames tagged snap. It has its own settings and cooldown; it is a different setup from the one-board doorbell above.
Find the missing step
| Problem | Next check |
|---|---|
| The board will not join Wi-Fi | A 2.4 GHz network, antenna connection, and saved settings |
| A press produces no photo | Board has finished starting; the 30-second gap has elapsed; camera is connected |
| A photo arrives but no alert is queued | press tag, enabled routine, scope, minimum interval of 0, and six-minute cooldown |
| An alert is queued but email is absent | Alert email address, delivery status, account limits, and spam folder |
| A manual snapshot is not emailed | snap is excluded by the doorbell routine; use or adapt the separate snapshot-mail routine |
Ask your agent what the image means
Share the photo with an image-capable agent and ask it to help decide what to do next. Does the tray look empty? Has something moved into the frame? Would another picture answer the question?
Give the agent the image, the capture time, and any useful sensor readings. Ask for a next step, such as notifying you or requesting another snapshot. The image analysis happens in the agent you choose.
With an agent connected to Warblet, you can also work on the response: inspect device messages, write and test routines, or send a command your firmware supports. Start with a photo you can check yourself, then build on what you learn.
Start with one useful picture
Get one button press, one fresh photo, and one email working together. Then adapt the trigger to the moment you care about. Your board provides the image; Warblet provides the dashboard and routine that help turn it into a useful response.