🎉 Celebrate with 10% OFF on All Products! Use Code: GFEX10 Or Buy Any 2+ Items for 30% OFF with Code: GFEX30!

Gravity Forms Direct Mail Premium Add-on Setup Guide

Updated 7 min read Gravity Forms Integrations A–Z
On this page
  1. What you need
  2. Step 1: install and connect
  3. The other settings
  4. Step 2: add a feed to a form
  5. Recipient address
  6. Content
  7. More options
  8. How sending works
  9. On every entry
  10. Merge tags
  11. Notification events
  12. Hooks for developers
  13. Good to know

The Gravity Forms Direct Mail Premium Add-on prints and posts a real postcard or letter through your own Lob, PostGrid or Stannp account when a Gravity Forms form is submitted. A feed decides which provider sends it, whether it is a postcard or a letter, the recipient address (mapped from the form), the content (a provider template id or simple HTML with merge tags) and when it is sent (conditional logic). The mailpiece is created in the background, so the visitor never waits, and the tracking id is written to the entry. Nothing goes through GravityExtra: your site talks straight to your provider with your own API key.

What you need

  • WordPress 5.8 or newer, PHP 7.4 or newer and Gravity Forms 2.5 or newer. Tested with Gravity Forms 3.1.2 on PHP 8.3 and Gravity Forms 2.9.8 on PHP 7.4.
  • An account with at least one of Lob, PostGrid or Stannp. Each one lets you sign up and create an API key yourself. Lob and PostGrid give you a separate test key and live key; Stannp has a test mode you switch on.
  • The API key of each provider you want to use, from the provider dashboard. The key is stored encrypted and is only ever sent to that provider.
  • Your GravityExtra licence key. Without an active licence nothing is created and the entry gets a note that says so.

The add-on follows the provider API references read on 26 October 2026. It creates a postcard with Lob at POST https://api.lob.com/v1/postcards, with PostGrid at POST https://api.postgrid.com/print-mail/v1/postcards and with Stannp at POST https://api-us1.stannp.com/v1/postcards/create (and the matching letter endpoints), each with your own key. This add-on handles the physical mailing. It does not generate a PDF: if you already have a generated PDF, point a feed at a provider template that renders it and the add-on will post it.

Step 1: install and connect

  1. Upload and activate the add-on in Plugins.
  2. Open Forms → Settings → Direct Mail and activate your licence key.
  3. Choose the Default provider, leave Send mode on Test for now, and paste the API key of each provider you use. Press Save.
  4. Fill in the Return address (Lob and PostGrid print one, and a letter needs it), then press Check the connection. The add-on reads your account with the default provider and creates nothing.
The Direct Mail settings screen in Gravity Forms: the licence box, the default provider, the send mode, the encrypted Lob, PostGrid and Stannp API keys, the return address, the daily cap and the Check the connection button
The settings: the default provider, your encrypted API keys and the return address printed on every mailpiece.

Each API key is encrypted before it is saved, with a key made from your site’s own security salts, and it is never shown again. Leave a key box empty to keep the stored key, or tick Remove the stored Lob API key when saving (and the same for PostGrid and Stannp) to delete it. The add-on only ever sends a key to the host of its own provider, so a key can never reach anywhere else.

The other settings

  • Default provider: Lob, PostGrid or Stannp. Each feed can override it, so you can test one provider while another handles live mail.
  • Send mode: Test or Live. In Test mode nothing is posted: for Stannp a sample is made, and for Lob and PostGrid you use a test API key. Switch to Live only when a test mailpiece looks right.
  • Default mailpiece: Postcard or Letter, used by a feed that does not pick its own.
  • Return address: the name and address printed as the sender. Lob and PostGrid require it for letters. Stannp uses the sender set on your account.
  • Daily cap of mailpieces: after this many in one day (UTC), over all feeds, the add-on stops and writes a note. Empty or 0 means no cap.

Step 2: add a feed to a form

  1. Open the form, go to Settings → Direct Mail and press Add New.
  2. Give the feed a name that says what it does, for example Welcome postcard.
  3. Pick the Provider (or leave it on the default) and the Mailpiece type.
  4. Map the Recipient address from the form and write the Content, then turn on the Condition if the mailpiece is only for some entries, and save.
A Direct Mail feed: the provider, the mailpiece type, the recipient address mapped from the form, the content with merge tags, the more options table and the condition
A feed: the provider, the mailpiece, the recipient address mapped from the form and the content.

Recipient address

Map each address field from the form with its merge tag, or type a fixed value. The name, address line 1, city, postcode and country are needed; company, a second address line and the state or region are optional. The country can be a two-letter code (US, GB, CA) or a name the add-on recognises, such as United Kingdom. If a required field is empty after the merge tags are replaced, the mailpiece is not created and the entry note says exactly what was missing, so nothing is posted to half an address.

Content

The Front / content field takes either a provider template id (for a design you saved in the provider dashboard, such as tmpl_abc123 or a Stannp template number) or simple HTML with merge tags. For a letter this is the letter body; for a postcard it is the front. The optional Postcard back field is the back of a postcard; leave it empty to reuse the front. A generated PDF can be mailed by pasting the template id that points to it; the add-on posts it but does not create the PDF.

More options

The options table maps a small set of provider options from fields or typed values: size (for example 4×6, 6×9 or us_letter), color (true or false), double_sided (for letters), mail_class, description, template_id and merge_variables (a JSON object of values your template uses). An option name that the add-on does not know is ignored with a note, and a value that is not valid is left out with a note, so a typo never silently changes a mailpiece.

How sending works

When an entry is saved, every feed whose condition matches is queued, and a background job creates the mailpiece. The visitor only waits for the normal confirmation. Each send carries a unique idempotency key made from the site, the entry and the feed, so a repeated request can never post the same mailpiece twice. Lob and PostGrid are sent the key as an Idempotency-Key header, and the add-on records the key for every provider on the entry.

If the provider cannot be reached (a DNS or connection error), the add-on tries again after 1 minute, 5 minutes, 30 minutes, 2 hours and 12 hours, with the same idempotency key, then gives up with a note. If a request times out, is reset, or the provider answers with a 5xx or an answer that cannot be read, the mailpiece may already have been created, so the add-on does not try again: the entry is marked unsure and the note gives the idempotency key to look up in the provider logs. A rate limit (429) is retried, and a clear refusal (a wrong key, or an address the provider rejects) is final and explained in the note with the provider’s own words.

The Direct Mail box on a Gravity Forms entry: the recipient, the mailpiece type, the provider piece id and the expected delivery date
The entry: the recipient, the mailpiece, the provider piece id and the expected delivery date.

On every entry

Each entry gets a Direct Mail box with the recipient, the mailpiece type, the provider piece id and the expected delivery date, and a note for every feed. Notes keep only the recipient town, postcode and country, never the full street. In the entry list, two bulk actions let you catch up: Send Direct Mail (skip sent) creates a mailpiece for entries that do not have one yet, and Send Direct Mail again (creates another mailpiece) posts a second one with a new idempotency key.

Merge tags

Four merge tags carry the result of a feed into notifications and confirmations: {directmail_status}, {directmail_id} (the provider piece id), {directmail_provider} and {directmail_expected} (the expected delivery date). Add _<feed id> to a tag to read one feed when a form has several, for example {directmail_status_3}.

Notification events

On a form that has a feed, two notification events appear: Direct Mail: the mailpiece was created and Direct Mail: the mailpiece could not be created. Each is sent once per entry and feed, so you can e-mail yourself when a mailpiece is created or when one fails, with the merge tags above in the message.

Hooks for developers

The filter gform_direct_mail_payload runs just before a mailpiece is created and lets you change the address, the content and the options, or cancel the mailpiece for an entry by returning a non-array. It is also available per form and per feed as gform_direct_mail_payload_<form id>_<feed id>. Two actions report the result: gfdm_mail_sent fires when the provider created the mailpiece, with the result state, and gfdm_mail_failed fires when it could not be created, with the reason. Use them to log to your own system or to trigger a follow-up.

Good to know

  • Start in Test mode and look at a sample before you switch to Live. Real mail is printed and charged to your account.
  • Set the daily cap while you are testing a busy form, so a mistake cannot post hundreds of mailpieces.
  • Use the condition to post only for the entries that should get mail, for example only a paid plan or only a chosen country.
  • With a payment add-on, the delayed-feed option posts the mailpiece only after payment is completed, so order mail goes out for paid orders only.

That is the whole add-on: choose a provider, map the address and the content, and every matching entry turns into a postcard or letter in the post, created in the background, never mailed twice, with the tracking id on the entry.

Still need help?

Our support team answers tickets every day, usually within a few hours.

0
0
Your Cart
Your cart is emptyReturn to Shop
🔥 FREQUENTLY BOUGHT TOGETHER
Complete Combo & Save 40%!
ITEM IN YOUR CART
Gravity Forms Klaviyo Add-on
$39.00/yr
+
🎁 RECOMMENDED ADD-ON SAVE 40% OFF
Original Price: $39.00/yr
Bundle Special Price: $23.40/yr