Sending emails from a mail alias
Currently, Zenphi's native Google Workspace email actions don't natively allow you to send an email from a domain alias (where you use the primary Google account (e.g. .ai) but want the "From" address to reflect your secondary domain (e.g. .nl)).
To solve this, I built a quick custom flow using Zenphi's HTTP Request action to talk directly to the Gmail API. It works flawlessly because the Gmail API respects the From: header inside an RFC 2822 formatted message, as long as the alias is already verified and added to your "Send mail as" settings in Gmail.
Below is the step-by-step breakdown of how the flow works, followed by the complete Zenphi blueprint JSON if you want to copy it!
How the Flow Works:
Encode Messag Base64 Action: The Gmail API requires the raw email (including headers) to be a base64url encoded string. I use this action to convert the raw e-mail block. Note that in the email format, there are no body labels. Headers and body are simply separated by a single blank line:
Plaintext
From: account@scripvade.nl To: account@domain.com Subject: Dit is de header voor het onderwerp Dit is direct de body van de e-mail.Redeem OAuth Token: Pulls the access token from your existing Google Workspace account (not .
Make HTTP Request: Sends a POST request to https://gmail.googleapis.com/gmail/v1/users/me/messages/send with the Bearer token. The payload body is simply structured as: {"raw": "{{Base64_Result}}"}
And this is the Curl for the HTTP Request Action:
curl --request POST \
--url "https://gmail.googleapis.com/gmail/v1/users/me/messages/send" \
--header "Authorization: Bearer JOUW_OAUTH_ACCESS_TOKEN" \
--header "Content-Type: application/json" \
--data '{
"raw": "THE_ENCODED_MESSAGE"
}'