composeEmail
Shows the email compose Dialog, or sends an email without an interface popup.
Parameters
emailOptions - (optional) Json object with email parameters.
to - array of email addresses
cc - array of email addresses
bcc - array of email addresses
text - message text
subject - subject
from - single string with an email address
fromDisplayName - single string with a display name for the from address (optional, if supported by mail server)
replyTo - single email, that will be used as to reply to
autoSend - if set to true, the mail will be send automatically. You will not see a dialog at all. (Default is false)
hideToEmail - if set to true, the recipients email address will be hidden in the email dialog
attachmentIds - an array of attachment ids that will be sent as an attachment,
attachmentBlobs - an array of blobs objects that will be sent as an attachment, {name: myFileName, blob: myBlob}
recordId - RecordId if you would like to attach the email to an record. If empty, this is the current record Id (available from 18.11.2021)
appName - AppName if you would like to attach the email to an record. If empty, this is the current App Name (available from 18.11.2021)
Example Usages
Example 1
Shows the dialog without any predefined values
Shows the dialog text and to addresses
app.composeEmail({
text: `This is the messsage text and this is a link: <a href='http://www.gebra-it.de' target='_blank'>www.gebra-it.de</a>`,
to:["john.doe@acme.com", "jane.doe@acme.com"],
subject: "This is the mail subject",
from: "noreply@acme.com",
fromDisplayName: "Bob"
});
Example 2
Sends the email without a dialog
app.composeEmail({
text: "This is the messsage text",
to:["john.doe@acme.com", "jane.doe@acme.com"],
subject: "This is the mail subject",
from: "noreply@acme.com",
replyTo: "reply@acmy.com",
autoSend: true //Set this to avoid the dialog
});
Example 3 - attachment blobs
In this case getAttachmentById(attachmentId) returns the respective blob.
app.composeEmail({
text: "This is the messsage text",
to:["john.doe@acme.com", "jane.doe@acme.com"],
subject: "This is the mail subject",
from: "noreply@acme.com",
autoSend: true,
attachmentBlobs: [
{
name: "Test1.pdf",
blob: app.createReport("report")
},
{
name: "Test2.pdf",
blob: app.getAttachmentById(2)
}
],
});
Example 4 - attachment ids
app.composeEmail({
text: "This is the messsage text",
to:["john.doe@acme.com", "jane.doe@acme.com"],
subject: "This is the mail subject",
from: "noreply@acme.com",
autoSend: true,
attachmentIds: [1, 2, 3]
});
Last updated
Was this helpful?