Send Gmail message with attachment
  • 30 May 2023
  • 1 Minute to read
  • Dark
    Light

Send Gmail message with attachment

  • Dark
    Light

Article Summary

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 which will be used as the boundary in the message. 
  4. Each attachment must be inside its own 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-printable

<div dir=3D"ltr">This is a message with an attachment.<div><br></div>


--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



Was this article helpful?

Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.