Pica Logo

Pica Assistant

Your integration companion

Pica Logo

Welcome to Pica! ✨

I'm here to help you discover how Pica can transform your workflow with powerful integrations.

Popular questions

Hover to see more

+7 more questions

Bolt LogoΓ—Gmail
Gmail

Building a Contact Form with Gmail

Create a production-ready contact form that sends submissions via Gmail using Bolt and Pica

November 14, 2024
Pica Team
gmailcontact-formemailbuildkit

In this guide, we'll build a contact form that sends submissions directly to your email via Gmail. With Bolt and Pica, you can create a production-ready contact form in minutesβ€”no backend servers or complex email configuration required.

What You'll Build

By the end of this tutorial, you'll have:

  • A beautiful contact form with name, email, and message fields
  • Gmail integration to receive form submissions
  • Customizable email templates for your brand
  • Production-ready error handling

Let's get started! πŸš€

Step 1: Build the Contact Form UI

First, let's create a clean, professional contact form using Shadcn components.

Prompt Bolt:

"Build me the UI for a contact form that has fields for a name, email and message. Use Shadcn components."

Bolt will generate a beautiful, responsive contact form with proper validation and styling.

Contact Form

Step 2: Create a Gmail Connection in Pica

You need to connect your Gmail account to Pica so your form submissions can be sent to your email.

Gmail Connection

How to Connect Gmail:

  1. Go to the Pica dashboard at: app.picaos.com/connections
  2. Click on + Add Connection
  3. Select Gmail from the list of integrations
  4. Authenticate with your Google account
  5. Save your connection key - you'll need this later!

Step 3: Generate Your Code with BuildKit

Now we'll use Pica BuildKit to generate the perfect prompt for handling form submissions and sending emails.

Using BuildKit:

  1. Go to the BuildKit page at: app.picaos.com/buildkit
  2. Type: "Send an email via Gmail"
  3. BuildKit will generate an optimized prompt for you

Or copy the prompt here:

Important: Replace [YOUR_RECIPIENT_EMAIL] in the prompt with the email address where you want to receive form submissions (e.g., contact@yourcompany.com).

What BuildKit Does:

BuildKit automatically generates a prompt that includes:

  • βœ… Proper API authentication setup
  • βœ… Base64url encoding for email content
  • βœ… Error handling best practices
  • βœ… Environment variable configuration
  • βœ… Integration with your Pica Gmail connection

Simply copy the generated prompt and paste it into Bolt.new to create your backend logic!


Step 4: Add Your Secrets to Bolt

Once Bolt generates your application, you'll need to add your API keys as environment variables.

Add Secrets

Required Environment Variables:

1. PICA_SECRET_KEY

2. PICA_GMAIL_CONNECTION_KEY

How to Add Secrets in Bolt:

  1. Click on the Settings icon in Bolt
  2. Navigate to Secrets
  3. Add both keys with their respective values
  4. Save and restart your application

Now your contact form is connected to Gmail and will send submissions to your recipient email from the address of the connected integration in Pica! πŸŽ‰


Step 5: Customize Your Email Design

Now that your backend is set up, you can customize the email template to match your brand! Bolt makes it easy to modify the email design with simple instructions.

Example Customization:

Try telling Bolt:

"Please update the email design. Add a header section with a gradient background from #c31432 to #240b36, and include a white heading inside that header that reads 'Contact Form Submission'."

Bolt will automatically update the HTML email template with your brand colors!

Customized Contact Email

Troubleshooting

Form not sending emails?

  1. Check your environment variables - Make sure both keys are set correctly in your Bolt secret settings
  2. Verify your Gmail connection - Go to app.picaos.com/connections and ensure it's active
  3. Check the recipient email - Make sure you replaced [YOUR_RECIPIENT_EMAIL] in the code
  4. Check Pica logs - View execution logs in your Pica dashboard

Conclusion

Congratulations! πŸŽ‰ You've just built a production-ready contact form in minutes. No email server configuration, no complex API setupβ€”just clean, working code.

Ready to add more integrations? Explore other Bolt use cases to supercharge your application with Pica.


Get Help

Questions or need support?

Happy building! πŸš€

Ready to build with Bolt?

Start creating AI-powered applications with seamless Gmail integration today