# Gmailbox

## Introduction

Danger: 

https://www.youtube.com/watch?v=aC278buklrM

Ahhh, the charms of suburbia, mowing the lawn, white picket fences, running barefoot to the mailbox to see if the postal worker already dropped by. Sometimes we wax nostalgic for our childhood. Maybe we’ve become de-sensitized to the constant work email notification pop-ups on our smartphones.

Wouldn’t it be nice to get a friendlier heads up? Do you ever miss the old-school “You’ve got mail!” sound from your old AOL email client?  
  
We're going to make a small mailbox to sit on your desk and notify you about incoming emails. When a new email is received, it raises a flag and gently lowers it back down.

**It's a fun, easy, introductory project to the Internet-of-Things by making things move using&nbsp;[Adafruit IO](https://io.adafruit.com/)&nbsp;with [IFTTT](https://ifttt.com/).**

## Parts

You'll need the following parts to complete this guide.

![3d_printing_parts-esp8266.jpg](https://cdn-learn.adafruit.com/assets/assets/000/059/473/medium640/3d_printing_parts-esp8266.jpg?1534787444)

Featured
### Adafruit Feather HUZZAH with ESP8266 - Loose Headers

[Adafruit Feather HUZZAH with ESP8266 - Loose Headers](https://www.adafruit.com/product/2821)
Feather is the new development board from Adafruit, and like its namesake, it is thin, light, and lets you fly! We designed Feather to be a new standard for portable microcontroller cores.

This is the&nbsp; **Adafruit Feather HUZZAH ESP8266** &nbsp;- our take on an...

In Stock
[Buy Now](https://www.adafruit.com/product/2821)
[Related Guides to the Product](https://learn.adafruit.com/products/2821/guides)
![Angled shot of black, rectangular WiFi development board.](https://cdn-shop.adafruit.com/640x480/2821-07.jpg)

Featured
### Sub-micro Servo - SG51R

[Sub-micro Servo - SG51R](https://www.adafruit.com/product/2201)
This is just about the cutest, tiniest little micro servo we could find, even smaller than the 9-gram micro servos we love so much. &nbsp;It can rotate approximately 180 degrees (90 in each direction) and works just like the standard kind you're used to but&nbsp;_much smaller_....

In Stock
[Buy Now](https://www.adafruit.com/product/2201)
[Related Guides to the Product](https://learn.adafruit.com/products/2201/guides)
![Sub-micro Servo with three pin cable ](https://cdn-shop.adafruit.com/640x480/2201-01.jpg)

### Supplies
Wire and handy supplies for soldering.

### Silicone Cover Stranded-Core Wire - 25ft 26AWG - Black

[Silicone Cover Stranded-Core Wire - 25ft 26AWG - Black](https://www.adafruit.com/product/2517)
Silicone-sheathing wire is super-flexible and soft, and its also strong! Able to handle up to 200°C and up to 600V, it will do when PVC covered wire wimps out. We like this wire for being extremely supple and flexible, so it is great for wearables or projects where the wire-harness has to...

In Stock
[Buy Now](https://www.adafruit.com/product/2517)
[Related Guides to the Product](https://learn.adafruit.com/products/2517/guides)
![Black stranded-core wire on a reel.](https://cdn-shop.adafruit.com/640x480/2517-01.jpg)

### Solder Spool - 1/4 lb SAC305 RoHS lead-free /  0.031" rosin-core

[Solder Spool - 1/4 lb SAC305 RoHS lead-free /  0.031" rosin-core](https://www.adafruit.com/product/734)
If you want to make a kit you'll need some solder. This 1/4 lb (about 110 gram) spool is just the right amount, not too much (like 1 lb spools) and not too little (like those little 'pocket clip' vials). This spool of solder is 0.031" in diameter, with the 'industry...

In Stock
[Buy Now](https://www.adafruit.com/product/734)
[Related Guides to the Product](https://learn.adafruit.com/products/734/guides)
![Solder Spool - 1/4 lb SAC305 RoHS lead-free / 0.031" rosin-core .](https://cdn-shop.adafruit.com/640x480/734-03.jpg)

### Tools
To build your Gmailbox, you'll need access to the following tools. Don't have something listed? Pick it up from the Adafruit shop.

### Hakko Professional Quality 20-30 AWG Wire Strippers

[Hakko Professional Quality 20-30 AWG Wire Strippers](https://www.adafruit.com/product/527)
These are the finest wire strippers we have used, and if you have to do a lot of wiring, you will agree! They have soft rounded grips - very comfortable to use, and precision ground notches that do a perfect job every time. No more yanking or twisting to strip wires cleanly and quickly.<br...></br...>

Out of Stock
[Buy Now](https://www.adafruit.com/product/527)
[Related Guides to the Product](https://learn.adafruit.com/products/527/guides)
![Red and black multi-size wire stripplers, closed](https://cdn-shop.adafruit.com/640x480/527-02.jpg)

## Hardware

You'll need some screws and nuts to secure the parts together. We have them linked here but you can source them from your local hardware supplier.&nbsp;

### Part: M2 x 12mm Machine Screws
quantity: 2
Micro Servo – M2x 12mm Flat Head Phillips
[M2 x 12mm Machine Screws](https://www.albanycountyfasteners.com/2MM-x-4-Phillips-Flat-Head-Machine-Screw-p/1011-1000.htm)

### Part: M2 Hex Nuts
quantity: 2
M2 Metric Hex Jam Nuts
[M2 Hex Nuts](https://www.albanycountyfasteners.com/Metric-Hex-Jam-Nuts-A2-Stainless-Steel-p/5580000.htm)

### Part: M2.5 x 6mm Machine Screws
quantity: 4
Feather HUZZAH – M2.5 x 6mm Flat Head Phillips
[M2.5 x 6mm Machine Screws](https://www.albanycountyfasteners.com/2-5-MM-x-45-Phillips-Flat-Head-Machine-Screw-p/1011-1002.htm)

### Part: M3 x 8mm Machine Screws
quantity: 2
Pole Bracket – M3 x 8mm Metric Pan Head Phillips
[M3 x 8mm Machine Screws](https://www.albanycountyfasteners.com/Phillips-Pan-Head-Machine-Screw-M3-x-5-p/1066-1008.htm)

### Part: M3 Hex Nuts
quantity: 2
M3 Metric Hex Jam Nuts
[M3 Hex Nuts](https://www.albanycountyfasteners.com/Metric-Hex-Jam-Nuts-A2-Stainless-Steel-p/5580000.htm)

![](https://cdn-learn.adafruit.com/assets/assets/000/059/458/medium800/3d_printing_duo-boxes.jpg?1534775959)

# Gmailbox

## 3D Printing the Mailbox

Danger: 

## Gmailbox Parts
![](https://cdn-learn.adafruit.com/assets/assets/000/059/353/medium800/3d_printing_3d-parts.jpg?1534524908)

There are six 3D-printed parts which make up the Gmailbox:

- Mailbox Bottom
- Mailbox Top
- Servo Holder
- Mailbox Cover (Front)
- Mailbox Cover (Back, Micro-USB cutout)

## What if I don't have a 3D Printer?

Not to worry! You can use a 3D printing service such as&nbsp;[3DHubs](https://www.3dhubs.com/)&nbsp;or&nbsp;[MakeXYZ](https://www.makexyz.com/)&nbsp;to have a local 3D printer operator 3D print and ship you parts to you. This is a great way to get your&nbsp;parts 3D printed by local makers. You could also try checking out your local Library or search for a Maker Space.

## Slicer Settings for Cura
 **Layer height:** 0.2mm  
**Line Width:** 0.38mm  
**Wall Thickness:** 2 line count  
**Infill:** 20% triangle pattern&nbsp;  
**Print Speed:** 60mm/s  
**Extruder/Bed Temps:** 220c / 60c  
**Supports:** Nope!

![3d_printing_cura-slice-preview.jpg](https://cdn-learn.adafruit.com/assets/assets/000/059/342/medium640/3d_printing_cura-slice-preview.jpg?1534520396)

## CAD Assembly

This animation demonstrates how the parts fit together. The assembly was designed for 3D printing and optimized to print without any supports. The front cover hinges onto the case while the back cover snap fits shut. The bottom cover is clamped to the case. The STL files are oriented to print "As-is".&nbsp;

![3d_printing_cad-explode.gif](https://cdn-learn.adafruit.com/assets/assets/000/059/435/medium640thumb/3d_printing_cad-explode.jpg?1534633774)

## Design Source Files

The enclosure assembly was designed in Fusion 360.&nbsp;This can be downloaded in different formats like STEP, SAT and more. Electronic components like the board, displays, connectors and more can be downloaded from our [Fusion 360 CAD parts github repo](https://github.com/adafruit/Adafruit_CAD_Parts).

If you need another format for your printer, use the following link:

[Download Files on GitHub](https://github.com/adafruit/Adafruit_Learning_System_Guides/tree/master/Gmailbox_Adafruit_IO)
[Fusion 360 Source ](https://a360.co/2KP0lB6)
[Download STLs on Thingiverse](https://www.thingiverse.com/thing:3057483)
## Tap Mounting Holes

The mounting holes in the bottom cover and case will need to be tapped using an M2 and M2.5 tap tools. This will create threads inside the mounting holes to allow precise fastening.

![3d_printing_taptools.jpg](https://cdn-learn.adafruit.com/assets/assets/000/059/394/medium640/3d_printing_taptools.jpg?1534601422)

## Making Threads

A tapping tool has coarse and sharp edges that are designed to scope out excess material. A tap handle is used instead of a drill to minimize friction caused by rotational speed (PLA plastic melts!). Slowly twisting the handle produces better results. Try to be as straight as possible when tapping holes.

![3d_printing_btm-threads.jpg](https://cdn-learn.adafruit.com/assets/assets/000/059/397/medium640/3d_printing_btm-threads.jpg?1534601882)

## Tap Holes in Case

The two mounting holes on the side of the case feature geometry optimized for 3D printing. The part is printed vertically and produces holes that have slightly tighter tolerances. Use an M2 tapping tool to create threads in the mounting holes.

![3d_printing_case-tap.jpg](https://cdn-learn.adafruit.com/assets/assets/000/059/425/medium640/3d_printing_case-tap.jpg?1534621368)

## Tap Plate

The two mounting holes in the flat plate are also M2 sized and slightly tighter. These were also tapped. The M2 size tapping tool has a very small shank that did not fit my tap handle – So I designed and 3D printed one!

![3d_printing_plate-tap.jpg](https://cdn-learn.adafruit.com/assets/assets/000/059/426/medium640/3d_printing_plate-tap.jpg?1534621561)

## Install Plate

Place the plate over the side of the case with the ovular opening. Line up the mounting holes. Insert and fasten two M2 x 12mm flat head machine screws.

![3d_printing_plate-install.jpg](https://cdn-learn.adafruit.com/assets/assets/000/059/423/medium640/3d_printing_plate-install.jpg?1534621171)

## Mounting Screws

Continue to fasten the screws until the shank is about halfway through the case. Hold the parts together while fastening.&nbsp;

![3d_printing_plate-fasten.jpg](https://cdn-learn.adafruit.com/assets/assets/000/059/424/medium640/3d_printing_plate-fasten.jpg?1534621272)

## Mailbox Parts Assembly

Once all of the parts are printed, a dry fit test will ensure everything fits properly or may need a bit of sanding. Start with the **case** and **back** cover parts first. Press the **back** cover onto the end of the&nbsp; **case** with the flat side. Fit the lip over the case on one side and press fit the other side to snap the edges together. Insert the **bottom** cover in between the rail of the **case** and slide into the **back** cover. Fit the nubs from the **front** cover over the dimples in the lower corners of the **case**.

![3d_printing_box-assembly.gif](https://cdn-learn.adafruit.com/assets/assets/000/059/396/medium640thumb/3d_printing_box-assembly.jpg?1534601787)

# Gmailbox

## Putting it Together

Danger: 

## Wiring
![](https://cdn-learn.adafruit.com/assets/assets/000/059/355/medium800/3d_printing_gmailbox-wiring.png?1534525251)

Make the following connections between the servo and the Feather HUZZAH:

- **Servo** &nbsp; **Yellow&nbsp;** to **Feather** &nbsp; **Huzzah Digital Pin 14**
- **Servo** &nbsp; **Brown&nbsp;** to&nbsp; **Feather** &nbsp; **Huzzah&nbsp;GND Pin**
- **Servo**  **Red&nbsp;** to **Feather** &nbsp; **Huzzah&nbsp;3V Pin**

 **Not comfortable with soldering?** [You can order a Feather HUZZAH ESP8266 with stacking header](https://www.adafruit.com/product/3213)s pre-soldered, and use male/male jumper cables to connect the servo to your Feather HUZZAH.

Featured
### Premium Male/Male Jumper Wires - 40 x 3" (75mm)

[Premium Male/Male Jumper Wires - 40 x 3" (75mm)](https://www.adafruit.com/product/759)
Handy for making wire harnesses or jumpering between headers on PCB's. These premium jumper wires are 3" (75mm) long and come in a 'strip' of 40 (4 pieces of each of ten rainbow colors). They have 0.1" male header contacts on either end and fit cleanly next to each other...

Out of Stock
[Buy Now](https://www.adafruit.com/product/759)
[Related Guides to the Product](https://learn.adafruit.com/products/759/guides)
![Angled shot of Premium Male/Male Jumper Wires - 40 x 3 (75mm)](https://cdn-shop.adafruit.com/640x480/759-04.jpg)

## Assembly
## Install HUZZAH to Mount

Use two M2.5 x 4mm flat head machine screws to secure the Adafruit Feather HUZZAH to the bottom cover part. Place the PCB over the standoffs and line up the mounting holes. Fastening screws into standoffs work best when tapped and threaded. USB port should be facing the edge of the mount.

![3d_printing_feather-screws.jpg](https://cdn-learn.adafruit.com/assets/assets/000/059/408/medium640/3d_printing_feather-screws.jpg?1534618853)

## Installed HUZZAH

Flat head machine screws had a tapered screw head. This is nice for low clearance mount holes. The mounting holes on near the antenna have a slightly smaller diameter and should be tapped when intending to secure all four mount holes. Be cautious not to over tighten or that could damage the antenna.&nbsp;

![3d_printing_feather-install.jpg](https://cdn-learn.adafruit.com/assets/assets/000/059/409/medium640/3d_printing_feather-install.jpg?1534619168)

## Install Servo

Grab the servo and orient to match the mounting holes on the 3d printed case.&nbsp; Insert the servo, shaft first, through the opening in between the mounting holes. Press firmly to fit through the wall. If it's too tight to push through, loosen the opening by filing edge with filing tool or sand paper.&nbsp;

![3d_printing_servo-install-2.jpg](https://cdn-learn.adafruit.com/assets/assets/000/059/412/medium640/3d_printing_servo-install-2.jpg?1534619552)

## Secure Servo

Insert and fasten two M2 x 12mm machine screws on the outside of the case through the mounting tabs in the micro servo. Fasten until fully tighten. The flag mount plate has chamfered holes to allow flat head screws to be flush with the surface.&nbsp;

![3d_printing_servo-secure.jpg](https://cdn-learn.adafruit.com/assets/assets/000/059/413/medium640/3d_printing_servo-secure.jpg?1534619760)

## Flag Servo Horn

Use the single arm servo horn that came with your submicro servo. Superglue will bond the two surfaces together. Place the servo horn over the flag and line up the mounting holes. Glue and set dry. Use one of the small screws to secure the flag to the servo.

![3d_printing_flag.jpg](https://cdn-learn.adafruit.com/assets/assets/000/059/415/medium640/3d_printing_flag.jpg?1534620044)

## Install Flag

Line up the servo horn with the splines on the sub-micro servo. The position of the flag will need to be tweaked and adjusted to properly line up with the expected angles of degree.

![3d_printing_flash-install.gif](https://cdn-learn.adafruit.com/assets/assets/000/059/416/medium640thumb/3d_printing_flash-install.jpg?1534620174)

## Secure Flag

Once the position is figured out, insert the small screw through the flag. Fasten the screw through the flag until the tip pokes through the servo horn. Then,&nbsp; press fit the servo horn onto the splines. Continue to fasten the screw and hold onto the flag until fully tightened.&nbsp;

![3d_printing_flag-secure.jpg](https://cdn-learn.adafruit.com/assets/assets/000/059/417/medium640/3d_printing_flag-secure.jpg?1534620381)

## Building The Mailbox

Now that we have our parts secured and mounted, we can put everything together!&nbsp;

![3d_printing_parts-preassembly.jpg](https://cdn-learn.adafruit.com/assets/assets/000/059/418/medium640/3d_printing_parts-preassembly.jpg?1534620652)

## Back Cover

Start with the back cover. Line up the curve with the case and fit one side of the lip onto the indentation on the case. While holding the case, firmly press the other side of the lip on the back cover. The cover should snap fit and lock into place.

![3d_printing_assembly-box-back.gif](https://cdn-learn.adafruit.com/assets/assets/000/059/419/medium640thumb/3d_printing_assembly-box-back.jpg?1534620684)

## Bottom Cover

Line up the bottom cover so the USB port on the HUZZAH is facing the back cover. Insert one side of the railing on the case to the lip on the bottom case. Firmly press down on the other side to snap it onto the rail of the case. Slide the bottom cover up and firmly press to wedge it into the back cover.

![3d_printing_assembly-box-bottm.gif](https://cdn-learn.adafruit.com/assets/assets/000/059/421/medium640thumb/3d_printing_assembly-box-bottm.jpg?1534620866)

## Front Cover

Fit one side of the tab over the dimple on the case. Pinch the ends of the case together to allow clearance for fitting the other tab. Clip the tab over the case and onto the dimple to secure the hinge.

![3d_printing_assembly-box-front.gif](https://cdn-learn.adafruit.com/assets/assets/000/059/422/medium640thumb/3d_printing_assembly-box-front.jpg?1534621000)

# Gmailbox

## Adafruit IO Setup

Danger: 

If you do not already have an Adafruit IO account set up, head over to [io.adafruit.com](http://io.adafruit.com/) to link your Adafruit.com account to Adafruit IO.

We need to create a new feed to hold data for the incoming emails. Navigate to the [feeds page](https://io.adafruit.com/feeds) on Adafruit IO. Then click **actions&nbsp;-\>&nbsp;create new feed** , and name this feed&nbsp; **gmail**.&nbsp;

- If you do not already know how to create a feed, head over to [Adafruit IO Basics: Feeds](https://learn.adafruit.com/adafruit-io-basics-feeds).

![](https://cdn-learn.adafruit.com/assets/assets/000/054/866/medium800/3d_printing_gmail-feed.png?1528144221)

We're also going to need our Adafruit IO username and active key. Navigate to your profile and click the **View AIO Key** button to retrieve them. Write them down in a safe place, we'll need them for later.

![](https://cdn-learn.adafruit.com/assets/assets/000/054/870/medium800thumb/3d_printing_adafruit_io_username_and_password.jpg?1528144423)

Now that Adafruit IO is all set up, let's link IFTTT to your Gmail account.

# Gmailbox

## IFTTT Setup

Danger: 

# What happened with IFTTT?

Google implemented changes to their API ecosystem that will impacted the Gmail service on IFTTT. Unfortunately, this change means that all Gmail triggers were removed from IFTTT.

Please use the [Zapier Setup page](https://learn.adafruit.com/gmailbox/zapier-setup) for this guide, instead of this page.

![](https://cdn-learn.adafruit.com/assets/assets/000/055/208/medium800/3d_printing_ifttt-digital-marketing-tool-800x445.jpg?1528392844)

[If This Then That](https://ifttt.com/) is an internet service which can listen to services on the internet (such as a new tweet) and trigger physical device actions.

Once you're signed up and logged into [IFTTT](https://ifttt.com/), navigate to the [Create](https://ifttt.com/create)&nbsp;page to create your applet and click the **+this** button:

![](https://cdn-learn.adafruit.com/assets/assets/000/054/893/medium800/3d_printing_Make_an_Applet_-_IFTTT.png?1528145773)

When prompted to&nbsp; **Choose a Service** , use the search-bar to look for&nbsp; **Gmail**

![](https://cdn-learn.adafruit.com/assets/assets/000/054/895/medium800/3d_printing_Make_an_Applet_-_IFTTT-2.png?1528145883)

Next, we'll need to choose a trigger. This is an event which occurs in Gmail that's used to cause our action (_"then that")_ to occur. We'll need to retrieve any email which comes into our inbox.

Select&nbsp; **Any new email in inbox**

![](https://cdn-learn.adafruit.com/assets/assets/000/054/902/medium800/3d_printing_Make_an_Applet_-_IFTTT-3.png?1528146037)

Once the trigger is selected, you'll be taken back to the&nbsp; **If Then That** page. This time, **click on +that**

![](https://cdn-learn.adafruit.com/assets/assets/000/054/903/medium800/3d_printing_Make_an_Applet_-_IFTTT-that.png?1528146117)

On Step 4, search for&nbsp; **Adafruit&nbsp;** in the search bar and select&nbsp; **Send data to Adafruit IO&nbsp;** on the **Choose Action** page

![](https://cdn-learn.adafruit.com/assets/assets/000/054/906/medium800/3d_printing_Make_an_Applet_-_IFTTT-aaa.png?1528146196)

On Step 5, select&nbsp; **gmail&nbsp;** as the Feed Name. On the&nbsp; **Data to Save&nbsp;** field, click **Add ingredient&nbsp;** and then&nbsp; **select ReceivedAt&nbsp;from the dropdown**.

**Note:&nbsp;** While we could select any data element from the gmail feed, we don't want to leak important information such as the sender or subject. So, we'll send date/time data.&nbsp;

![](https://cdn-learn.adafruit.com/assets/assets/000/054/909/medium800thumb/3d_printing_action-field.jpg?1528146501)

 **Review the applet's settings to make sure they're correct**. Then,&nbsp; **click finish.**

![](https://cdn-learn.adafruit.com/assets/assets/000/054/913/medium800/3d_printing_iftt-6.png?1528146720)

Next, we're going to set up our Arduino for programming.&nbsp;

# Gmailbox

## Zapier Setup

Danger: 

![](https://cdn-learn.adafruit.com/assets/assets/000/055/207/medium800/3d_printing_Zapier_logo.png?1528392813)

[Zapier](https://zapier.com/)&nbsp;is a service for connecting web services to your Adafruit IO project. It offers support for Gmail, Twitter, and a few hundred other services. It's similar to IFTTT, but offers some additional flexibility.&nbsp;

 **First, you'll need an account at Zapier and an invite to the Adafruit IO app on Zapier.** &nbsp;Visit zapier.com to sign up, and then use&nbsp;[this link for the Adafruit IO app invite](https://zapier.com/developer/invite/25317/1135194f53df630effed7ccf66a8b81b/).

Launch the[Zapier Editor](https://zapier.com/app/editor/) to make a Zap (similar to an IFTTT action). Then, use the searchbar to search for Gmail.

![](https://cdn-learn.adafruit.com/assets/assets/000/054/914/medium800/3d_printing_Edit_a_Step___Zapier-1.png?1528147085)

Select&nbsp; **New Email** as a Gmail Trigger

![](https://cdn-learn.adafruit.com/assets/assets/000/054/915/medium800/3d_printing_Edit_a_Step___Zapier-2.png?1528147141)

1. Connect your Gmail account to Zapier&nbsp;
2. Then, click&nbsp; **test&nbsp;** to ensure it's correctly integrated with your Zapier account.

If you see&nbsp; **Success** , your Gmail was successfully connected.&nbsp;

![](https://cdn-learn.adafruit.com/assets/assets/000/054/916/medium800/3d_printing_Edit_a_Step___Zapier-3.png?1528147367)

Zapier will ask you to select a label or mailbox. Select **Inbox.**

_Note:_ This step is optional, if&nbsp;no Label/Mailbox is selected, this Zap will trigger on all e-mails, including Drafts.&nbsp;

Next, Zapier will proceed to test your Gmail account. If it integrates, it'll show a success message. Click N **ext.**

You'll also need an&nbsp; **Action App**. Search and select Adafruit IO (it's still in beta but that's o.k).

![](https://cdn-learn.adafruit.com/assets/assets/000/054/921/medium800/3d_printing_Edit_a_Step___Zapier-4.png?1528147679)

On the next step, select&nbsp; **Send Value to Feed&nbsp;** as an Adafruit IO action.

![](https://cdn-learn.adafruit.com/assets/assets/000/054/922/medium800/3d_printing_Edit_a_Step___Zapier-5.png?1528147832)

On "Select Adafruit IO Account", click&nbsp; **Connect an Account&nbsp;** and enter your Adafruit IO Active Key.&nbsp;

If you're not sure where to find this, navigate to your [Adafruit IO Profile](https://io.adafruit.com/profile/) and click View AIO Key

![](https://cdn-learn.adafruit.com/assets/assets/000/054/924/medium800/3d_printing_Connect_an_Account___Zapier.png?1528148104)

On the&nbsp;_Set up Adafruit IO Value_ feed, select&nbsp; **Date&nbsp;** from the dropdown for&nbsp; **Value**. Then, enter&nbsp; **Gmail** as the name of the Feed

![](https://cdn-learn.adafruit.com/assets/assets/000/054/925/medium800/3d_printing_Edit_a_Step___Zapier-7.png?1528148224)

Now, Zapier will test your Zap integrated with Gmail! Click the&nbsp; **Test&nbsp;** button and it'll send a test value to the gmail feed.&nbsp;

![3d_printing_Edit_a_Step___Zapier-8.png](https://cdn-learn.adafruit.com/assets/assets/000/054/937/medium640/3d_printing_Edit_a_Step___Zapier-8.png?1528148584)

Navigate to your&nbsp;_gmail&nbsp;_Adafruit IO Feed. You should see a new value created 'a few seconds ago'. If you don't, check over the previous steps.

![3d_printing_IO_-_Feed__gmail.png](https://cdn-learn.adafruit.com/assets/assets/000/054/940/medium640/3d_printing_IO_-_Feed__gmail.png?1528148742)

Click **Finish** and give your Zap a name. Then, turn it on and you're ready to retrieve emails.

&nbsp;

_Note:&nbsp;_Zapier retrieves emails every 5 minutes.&nbsp;

![3d_printing_Gmail_Adafruit_IO___Zapier.png](https://cdn-learn.adafruit.com/assets/assets/000/054/946/medium640/3d_printing_Gmail_Adafruit_IO___Zapier.png?1528148845)

# Gmailbox

## Arduino Setup

Danger: 

## Installing Libraries
This guide assumes you've completed the setup required to get your ESP8266 up and running with Arduino IDE and Adafruit IO.&nbsp;

- If you haven't yet set up your ESP8266 for use with Adafruit IO and the Arduino IDE,&nbsp;[follow along with this guide](https://learn.adafruit.com/adafruit-io-basics-esp8266-arduino/arduino-io-library). The setup only needs to be performed once.

The code for this example is contained within the&nbsp; Adafruit IO Arduino Library. Open the&nbsp; **adafruitio\_23\_ifttt&nbsp;** example from within the Arduino IDE:&nbsp; **File-\>Examples-\>Adafruit IO Arduino-\>adafruitio\_23\_ifttt**

![](https://cdn-learn.adafruit.com/assets/assets/000/059/437/medium800/3d_printing_Adafruit_IO_Arduino_and_Examples_and_File_and_Menubar.png?1534641636)

Next, we'll perform the network configuration required for this sketch.

# Gmailbox

## Arduino Network Config

To configure the network settings, click on the **config.h** tab in the sketch. You will need to set your Adafruit IO username in the **IO_USERNAME** define, and your Adafruit IO key in the **IO_KEY** define.

![](https://cdn-learn.adafruit.com/assets/assets/000/039/317/medium800/adafruit_io_03_config.png?1487185264)

## WiFi Config

WiFi is enabled by default in **config.h** so if you are using one of the supported WiFi boards, you will only need to modify the **WIFI_SSID** and **WIFI_PASS** options in the **config.h** tab.

![](https://cdn-learn.adafruit.com/assets/assets/000/039/318/medium800/adafruit_io_04_wifi.png?1487185900)

## FONA Config

If you wish to use the FONA 32u4 Feather to connect to Adafruit IO, you will need to first comment out the WiFi support in **config.h**

![](https://cdn-learn.adafruit.com/assets/assets/000/039/319/medium800/adafruit_io_05_wifi_disable.png?1487186164)

Next, remove the comments from both of the FONA config lines in the FONA section of **config.h** to enable FONA support.

![](https://cdn-learn.adafruit.com/assets/assets/000/039/320/medium800/adafruit_io_06_fona.png?1487186409)

## Ethernet Config

If you wish to use the Ethernet Wing to connect to Adafruit IO, you will need to first comment out the WiFi support in **config.h**

![](https://cdn-learn.adafruit.com/assets/assets/000/039/321/medium800/adafruit_io_05_wifi_disable.png?1487186577)

Next, remove the comments from both of the Ethernet config lines in the Ethernet section of **config.h** to enable Ethernet Wing support.

![](https://cdn-learn.adafruit.com/assets/assets/000/039/322/medium800/adafruit_io_07_ethernet.png?1487186729)

Next, we will look at how the example sketch works.

# Gmailbox

## Code

Danger: 

Let's take a dive into the code that powers our Gmailbox. It's not too hard to understand and this code can serve as an introduction to Arduino and Adafruit IO.

We'll start by setting up the servo holding the flag. We wired the servo to the Feather HUZZAH's pin 14. If you need to change that, you can modify `SERVO_PIN`. We also define the flag's up and down positions (what angle to set the servo's maximum to) as `FLAG_UP` and `FLAG_DOWN`.&nbsp;

Want the servo's flag to be held up longer? You can do that by modifying the `FLAG_DELAY`&nbsp;variable.

```auto
// pin used to control the servo
#define SERVO_PIN 14

// Flag's up position, in degrees
#define FLAG_UP 0

// Flag's down position, in degrees
#define FLAG_DOWN 180

// How long to hold the flag up, in seconds
#define FLAG_DELAY 2
```

Next, we're going to create an instance of the servo class and set up the&nbsp;_gmail&nbsp;_feed from Adafruit IO.

```auto
Servo servo;
AdafruitIO_Feed *gmail_feed = io.feed("gmail");
```

The `setup()`&nbsp;function starts a serial connection, attaches the servo to `SERVO_PIN`, and attempts to connect to Adafruit IO. Then, it creates a message handler to listen to the gmail feed. We'll also write the servo to its' resting state (the `FLAG_DOWN` position).

```auto
void setup() {

  // start the serial connection
  Serial.begin(115200);

  // wait for serial monitor to open
  while(! Serial);

  // tell the servo class which pin we are using
  servo.attach(SERVO_PIN);

  // connect to io.adafruit.com
  Serial.print("Connecting to Adafruit IO");
  io.connect();

  // set up a message handler for the 'servo' feed.
  // the handleMessage function (defined below)
  // will be called whenever a message is
  // received from adafruit io.
  gmail_feed->onMessage(handleMessage);

  // wait for a connection
  while(io.status() < AIO_CONNECTED) {
    Serial.print(".");
    delay(500);
  }

  // we are connected
  Serial.println();
  Serial.println(io.statusText());
  gmail_feed->get();

  // write flag to down position
  servo.write(FLAG_DOWN);

}
```

The `loop()`&nbsp;is empty aside from a call to `io.run()`, a function which keeps the client connected to [io.adafruit.com](https://io.adafruit.com/).

```auto
void loop() {
  io.run();
}

```

The `handleMessage` function is called whenever a new data value is received from the&nbsp;_gmail_ feed on Adafruit IO. Inside this function, we'll print to the serial monitor that a new email has been received.&nbsp;

Then, we'll set the flag to the `FLAG_UP`&nbsp;position to indicate a new email has been received. We'll wait `FLAG_DELAY` seconds and then move the flag back down by writing the servo to its' `FLAG_DOWN` position.&nbsp;

The `handleMessage` function is called when the _gmail_ feed is updated by Zapier or IFTTT.

When it receives new data from the&nbsp;_gmail&nbsp;_feed, it will write the servo to the&nbsp;`flagUp` position, waits a second so that you can see it, and moves it back to the `flagDown` position.

```auto
void handleMessage(AdafruitIO_Data *data) {
  Serial.println("You've got mail!");
  servo.write(FLAG_UP);
  // wait FLAG_DELAY seconds
  delay(FLAG_DELAY * 1000);
  servo.write(FLAG_DOWN);
}
```

## Testing out your Gmailbox
Upload the code to your Feather and open the Arduino Serial Monitor **(Tools -\> Serial Monitor)**.

```auto
IFTTT Gmailbox
Connecting to Adafruit IO
..
Connected to Adafruit IO!

```

If you see the above, we're all set up to receive emails! Compose an email to yourself and send it! When the&nbsp;_gmail&nbsp;_feed receives new data, the serial monitor will print&nbsp;_You've got mail!,_&nbsp;put the flag up, and gently lower it.

![](https://cdn-learn.adafruit.com/assets/assets/000/059/348/medium800thumb/3d_printing_learn-thumb.jpg?1534521550)

## Help - my Gmailbox isn't working!
### 

On the _gmail_ feed page, you can click on the **actions dropdown -\> add data.&nbsp;** You can enter any value, it doesn't matter for this project, and click&nbsp; **create**. You'll see a new data-point dropped onto the IO feed.&nbsp;

### 

First, check that the feed is set up correctly. Visit your [feed page](https://io.adafruit.com/feeds)&nbsp;for&nbsp;_gmail_ and ensure your feed was updated when an email arrived.&nbsp;

If your feed did update, but the servo flag didn't move, there's a chance it was wired incorrectly. Re-read the wiring diagram on the&nbsp;_Wiring and Assembly_ page. Make sure&nbsp;`SERVO_PIN` in the sketch is connected to the correct pin on your Feather HUZZAH.

### 

Check over your Zap or IFTTT Applet configuration. Make sure that the email is connected correctly.&nbsp;

## Code
https://github.com/adafruit/Adafruit_IO_Arduino/blob/master/examples/adafruitio_23_ifttt/adafruitio_23_ifttt.ino


## Guide Products

### Adafruit Feather HUZZAH with ESP8266 - Loose Headers

[Adafruit Feather HUZZAH with ESP8266 - Loose Headers](https://www.adafruit.com/product/2821)
Feather is the new development board from Adafruit, and like its namesake, it is thin, light, and lets you fly! We designed Feather to be a new standard for portable microcontroller cores.

This is the&nbsp; **Adafruit Feather HUZZAH ESP8266** &nbsp;- our take on an...

In Stock
[Buy Now](https://www.adafruit.com/product/2821)
[Related Guides to the Product](https://learn.adafruit.com/products/2821/guides)
### Sub-micro Servo - SG51R

[Sub-micro Servo - SG51R](https://www.adafruit.com/product/2201)
This is just about the cutest, tiniest little micro servo we could find, even smaller than the 9-gram micro servos we love so much. &nbsp;It can rotate approximately 180 degrees (90 in each direction) and works just like the standard kind you're used to but&nbsp;_much smaller_....

In Stock
[Buy Now](https://www.adafruit.com/product/2201)
[Related Guides to the Product](https://learn.adafruit.com/products/2201/guides)
### Silicone Cover Stranded-Core Wire - 25ft 26AWG - Black

[Silicone Cover Stranded-Core Wire - 25ft 26AWG - Black](https://www.adafruit.com/product/2517)
Silicone-sheathing wire is super-flexible and soft, and its also strong! Able to handle up to 200°C and up to 600V, it will do when PVC covered wire wimps out. We like this wire for being extremely supple and flexible, so it is great for wearables or projects where the wire-harness has to...

In Stock
[Buy Now](https://www.adafruit.com/product/2517)
[Related Guides to the Product](https://learn.adafruit.com/products/2517/guides)
### Solder Spool - 1/4 lb SAC305 RoHS lead-free /  0.031" rosin-core

[Solder Spool - 1/4 lb SAC305 RoHS lead-free /  0.031" rosin-core](https://www.adafruit.com/product/734)
If you want to make a kit you'll need some solder. This 1/4 lb (about 110 gram) spool is just the right amount, not too much (like 1 lb spools) and not too little (like those little 'pocket clip' vials). This spool of solder is 0.031" in diameter, with the 'industry...

In Stock
[Buy Now](https://www.adafruit.com/product/734)
[Related Guides to the Product](https://learn.adafruit.com/products/734/guides)
### Hakko Professional Quality 20-30 AWG Wire Strippers

[Hakko Professional Quality 20-30 AWG Wire Strippers](https://www.adafruit.com/product/527)
These are the finest wire strippers we have used, and if you have to do a lot of wiring, you will agree! They have soft rounded grips - very comfortable to use, and precision ground notches that do a perfect job every time. No more yanking or twisting to strip wires cleanly and quickly.<br...></br...>

Out of Stock
[Buy Now](https://www.adafruit.com/product/527)
[Related Guides to the Product](https://learn.adafruit.com/products/527/guides)
### Adjustable 30W 110V soldering iron

[Adjustable 30W 110V soldering iron](https://www.adafruit.com/product/180)
This 'pen-style' soldering iron is just about the best entry-level tool I've seen. It's not as powerful as a Weller WES51 but it _is_ self-contained and easy to use. With proper care, it will last for many years. Turn it off when not in use, clean the plated tip with a...

No Longer Stocked
[Buy Now](https://www.adafruit.com/product/180)
[Related Guides to the Product](https://learn.adafruit.com/products/180/guides)
### Panavise Jr.

[Panavise Jr.](https://www.adafruit.com/product/151)
The best mini-vise for working on smaller PCBs (2.875" or less in one dimension)! The jaws are strong plastic that wont damage the PCB and doesn't mind if you hit it with the soldering iron by accident. Made in the USA.

- The easy-to-use single knob controls head movement...

No Longer Stocked
[Buy Now](https://www.adafruit.com/product/151)
[Related Guides to the Product](https://learn.adafruit.com/products/151/guides)
### Ultimaker 2+ 3D Printer

[Ultimaker 2+ 3D Printer](https://www.adafruit.com/product/2673)
The **Ultimaker 2+** is one of our favorite 3D printers on the market. It's a well-built open-source compact machine with an excellent UX.&nbsp;Every inch of the Ultimaker 2+ is designed to create the most effortless and reliable 3D printing experience ever!&nbsp;<a...></a...>

No Longer Stocked
[Buy Now](https://www.adafruit.com/product/2673)
[Related Guides to the Product](https://learn.adafruit.com/products/2673/guides)

## Related Guides

- [Adafruit Feather HUZZAH ESP8266](https://learn.adafruit.com/adafruit-feather-huzzah-esp8266.md)
- [Make It Glow - Your First NeoPixel Project](https://learn.adafruit.com/make-it-glow-your-first-neopixel-project.md)
- [CPX Glowing Disembodied Hand](https://learn.adafruit.com/cpx-glowing-disembodied-hand.md)
- [No-Solder LED Disco Tie with Bluetooth](https://learn.adafruit.com/no-solder-circuit-playground-bluetooth-disco-tie.md)
- [Gemma M0 Sheikah Pendant](https://learn.adafruit.com/gemma-m0-sheikah-pendant.md)
- [Living Starry Night Painting](https://learn.adafruit.com/animated-starry-night-circuit-playground-express.md)
- [3D Printing on Diffraction Grating Sheets](https://learn.adafruit.com/3d-printing-on-diffraction-grating-sheets.md)
- [CircuitPython BLE Controlled NeoPixel Hat](https://learn.adafruit.com/circuitpython-feather-ble-neopixel-hat.md)
- [PyPortal Air Quality Display](https://learn.adafruit.com/pyportal-air-quality-display.md)
- [CircuitPython 2FA TOTP Authentication Friend](https://learn.adafruit.com/circuitpython-totp-otp-2fa-authy-authenticator-friend.md)
- [Make It Glow: How to Solder NeoPixels, A Beginner's Guide](https://learn.adafruit.com/make-it-glow-how-to-solder-neopixels-a-beginners-guide.md)
- [Pathfinder Robot Companion](https://learn.adafruit.com/pathfinder.md)
- [LEGO® compatible Battery Case](https://learn.adafruit.com/brick-compatible-battery-case.md)
- [Animated LED Sand](https://learn.adafruit.com/animated-led-sand.md)
- [Flashing LED Strand with MakeCode](https://learn.adafruit.com/flashing-led-strand-with-makecode.md)
- [Multi-tasking with CircuitPython](https://learn.adafruit.com/multi-tasking-with-circuitpython.md)
