sendEmailForFiles
Description
Send an email containing either links to or attachments of the requested vablet files by their file id.
Files must have the allow emailable flag set. This option is found in the vablet media settings.
Syntax
VabletNativeInterface.callNativeMethod(
"sendEmailForFiles",
{
to,
cc,
bcc,
subject,
body,
company,
queueIfNotAbleToSend,
fileIds,
includeAnnotation,
sendAsLink,
sendAsAttachment
},
(res) => {...}
);
Options
Bold keys are required.
| Key | Type | Description |
|---|---|---|
| to cc bcc |
stringobjectarray |
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. |
| includeAnnotation | boolean |
If this is true annotations are rendered into the files that are emailed |
| sendAsLink | boolean |
Sends the files as links to be downloaded instead of a direct attachment. If true then sendAsAttachment should be false |
| sendAsAttachment | boolean |
Sends the files as an email attachment. If true then sendAsLink should be false. |
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(
"sendEmailForFiles",
{
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 sendEmailForFiles email',
body: 'Here are the links to 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
includeAnnotation: false, // do not include the annotations
sendAsLink: true, // link to the vablet files instead of attaching
sendAsAttachment: false // don't send as an attachment, link instead
},
(res) => {
if (res.success) {
// Success!
alert('Email sent successfully!')
} else {
// Uh oh, let's alert the error!
alert(res.error)
}
}
);