Skip to content

useVabletGUIToSendEmailForFiles

Description

Open the vablet email GUI to send vablet file attachments or links.

Files must have the allow emailable flag set. This option is found in the vablet media settings.

Syntax

VabletNativeInterface.callNativeMethod(
  "useVabletGUIToSendEmailForFiles",
  {
    to,
    cc,
    bcc,
    subject,
    body,
    company,
    queueIfNotAbleToSend,
    fileIds,
  },
  (res) => {...}
);

Options

Bold keys are required.

Key Type Description
to
cc
bcc
string
object
array
The to, cc, and bcc fields accept an email, an array of emails, or an array of objects.
Example: [{name:'Name', email:'email@email.com}]
subject string Subject line for the email.
body string The email message. This is placed inside the body of your set email template for vablet.
company string Company name of the email recipient. This is an optional field used for logging and analytics.
queueIfNotAbleToSend boolean If this is set to true the email will attempt to resend until it successfully is sent. Useful for offline emailing.
fileIds int[] An array of vablet fileIds<int> to be sent as either a link or attachment.

Response

Key Type Description
success boolean Returns true on success and false for any errors.
Always true if queueIfNotAbleToSend is set to true
error string Error message, provided there is one.

Example

VabletNativeInterface.callNativeMethod(
  "useVabletGUIToSendEmailForFiles",
  {
    to: 'email@email.com',
    cc: ['1@email.com', '2@email.com'],
    bcc: [{name: 'Name 1', email: '1@email.com'},{name: 'Name 2', email: '2@email.com'}],
    subject: 'Sample vablet useVabletGUIToSendEmailForFiles email',
    body: 'Here are your vablet files',
    company: 'Recipient Company',
    queueIfNotAbleToSend: true, // add to queue handler if email fails to send
    fileIds: [123,456] // send vablet files with ids 123 and 456
  },
  (res) => {
    if (res.success) {
      // Success!
      alert('Email sent successfully!')
    } else {
      // Uh oh, let's alert the error!
      alert(res.error)
    }
  }
);