The SendMessageEx() function generates and sends an email to the specified user, group or raw email address.



Function arguments

  • mail – (Object) an object containing a message definition/properties. Below there are all possible properties, not all of them have to be used:
    • mail.recipient – (String) [Optional] a recipient’s email address, an AMODIT user or group name. Multiple addresses can be passed separated by semicolon;
    • – (Object) [Optional] a CC email address, an AMODIT user or group name. Multiple addresses can be passed separated by semicolon;
    • mail.bcc – (String) [Optional] a BCC email address, an AMODIT user or group name. Multiple addresses can be passed separated by semicolon;
    • mail.oneMail – (Boolean) [Optional] if set to true then one mail with multiple recipients will be sent, otherwise multiple messages will be sent – one message per recipient. By default it is set to false, but if cc or bcc are set then this property is set to true;
    • mail.addTemplate – (Boolean) [Optional] whether mail will be sent based on AMODIT mail template, default is true;
    • mail.language – (String) [Optional] a language of the mail template, if not set then user’s language is used;
    • mail.subject – (String) a subject of the mail;
    • mail.message – (String) a body of the mail;
    • mail.html – (Boolean) [Optional] whether the message contains HTML code/format;
    • mail.sender – (String) [Optional] a sender of the mail, if empty the value from system settings will be used. Attention! Mail server has to be configured to allow to send messages as specified sender;
    • mail.replyTo – (String) [Optional] what address will be set in replyTo field;
    • mail.addCaseIdToSubject – (Boolean) [Optional] whether to add CaseId to the message subject, default is true;
    • mail.addUrl – (Boolean) [Optional] whether to add case url to message body, default is true;
    • mail.addComment – (Boolean) [Optional] whether to add mail content to case as comment;
    • mail.addAttachments – (String) [Optional] whether to add attachments from case to mail. A formula to get attachments:
      • all – send all attachments;
      • field names – send attachment from form fields. Fields must be file type. You can pass a few fields splitted by ’;’;
      • template name – send attachments that match the template name based on which they were created;
      • file name – send attachment which match a pattern. Star '*’ in the pattern means any string;
    • mail.sendImmediately – (Boolean) [Optional] try to send a mail immediately without queue;
    • mail.attachments – (FileList) [Optional] file or list of files to send as attachments;
    • mail.attachmentsSource – (Decimal) [Optional] id of a source case for attachments, default is the main case.

Return value

The SendMessageEx() function returns Boolean.
Returns true if message was sent successfully, false otherwise.


Example 1

In this example the SendMessageEx() function will send an e-mail with properties specified in the mail variable (object).

mail.oneMail = true;
mail.addTemplate = false;
mail.language = "pl-PL"; 

Example 2

This will send a mail message with an attachment generated from the template.

AddFileToList(mail.attachments, file)


Czy artykuł był pomocny?
0 na 5 gwiazdek
5 Stars 0%
4 Stars 0%
3 Stars 0%
2 Stars 0%
1 Stars 0%
How can we improve this article?
How Can We Improve This Article?