Skip to main content
Send Gmail Message with an Attachment

Learn to attach files to Gmail messages by encoding to Base64 using the Encode base64 utility before employing the Gmail Send Message step."

Updated over a week ago

To send a Gmail message with a file attached, you will encode the file as a Base64 string and use the Gmail Send Message step and the Encode base64 utility step.

  1. Pass the file or information you desire to use as an attachment through the Encode base64 step, before the Gmail step.

  2. In the Gmail Send Message step, fill out any necessary parameters such as recipients, subjects, and access tokens.

  3. In the Content type parameter, write: multipart/mixed; boundary="XXXXboundary text"

    1. You can replace "XXXXboundary text" with any other text that will be used as the boundary in the message.

  4. Each attachment must be inside its section of boundary text.

  5. The Content parameter should be formatted as below:

This is a multipart MESSAGE_TEXT--XXXXboundary text
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printableThis is a message with an attachment.--XXXXboundary text--XXXXboundary text
Content-Type: text/plain; name="file.txt"
Content-Disposition: attachment; filename="file.txt"
Content-Transfer-Encoding: base64##{{ $.encode_base64.result }}--XXXXboundary text
Use Base64 to automatically encode attachments in Gmail messages
Did this answer your question?