This application automatically uploads email attachments from Postmark to Google Drive. When emails are sent to your Postmark inbound email address, any attachments are automatically saved to your specified Google Drive folder. The system uses AWS Lambda, API Gateway, and Secrets Manager to handle the OAuth flow and file uploads.
- Postmark: Receives emails and sends attachment data via webhooks
- API Gateway: Provides endpoints for OAuth callback and Postmark webhook
- Lambda Functions: Handle OAuth flow and attachment uploads
- Secrets Manager: Securely stores OAuth refresh tokens
- Google Drive API: Destination for email attachments
- Click the project dropdown → New Project
- Name it (e.g., PostmarkUploader)
- Click Create
- Go to APIs & Services → Library
- Search for Google Drive API
- Click Enable
- Go to APIs & Services → OAuth consent screen
- Choose External
- Fill in:
- App name
- Support email
- Developer contact email (these can all be your personal email)
- Add yourself as a test user using the Audience page on the sidebar
- Click Save and Continue
- Go to APIs & Services → Credentials
- Click Create Credentials → OAuth client ID
- Choose Web application
- Skip the redirect URI for now — you'll add it after deploying the stack
- Click Create
- Save the Client ID and Client Secret
- Click the Launch Stack button
- Fill in the parameters:
- GoogleClientId: (from step 1.5)
- GoogleClientSecret: (from step 1.5)
- GoogleDriveFolder: (optional) Name of the folder to store attachments
- LambdaTimeout: (optional) Default is 60 seconds. Increase for large attachments (up to 900s)
- Once the stack is deployed, go to the Outputs tab in CloudFormation
- Copy the OAuthURL output
- Return to Google Cloud Console → Client
- Click on your OAuth 2.0 client
- Edit the Authorized redirect URIs
- Paste in the URL you copied from the stack output
- Save changes
- In the stack outputs, find the OAuthURL
- Open it in your browser
- Click the link on your screen to begin authenticating with Google Drive.
- You will get a warning that Google has not verified this application. Click 'Continue'
- Approve access to Google Drive
- The Lambda will exchange the code for tokens and store them
- You can now close this page.
- Sign up at postmarkapp.com
- Create a new server (or use an existing one)
- In your Postmark dashboard, navigate to Servers → Your Server Name → Default Inbound Stream
- Navigate to Setup Instructions
- Note your unique inbound email address
- From the Settings page, find the Webhook URL field
- In the CloudFormation stack outputs, find the PostmarkWebhookURL value
- Copy this URL and paste it into the Postmark Webhook URL field
- Check the box below this field that will send the JSON payload to your Lambda function. EmailDrop parses this JSON to extract the attachments.
- Save your changes
- Send an email with attachments to your Postmark inbound email address
- The attachments should be automatically uploaded to your Google Drive folder
- Check the Lambda logs in CloudWatch if you encounter any issues
- GoogleDriveFolder: Change the folder where attachments are stored
- LambdaTimeout: Adjust timeout for handling large attachments
If attachments aren't being uploaded:
- Check CloudWatch Logs for the Lambda functions
- Verify the OAuth flow was completed successfully
- Ensure Postmark is correctly configured to send webhooks
- Test your Postmark inbound email by sending a test email with attachments