Table plus | |||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Syntax | sendEmail([from], to, [cc], subject, body_or_template, [language] | Package | Alias | Pkg Usage | ||||||||||||
Description
Excerpt | ||
---|---|---|
| ||
Sends an email. |
Sends an email. To and cc are string arrays with any of email addresses, users or groups. Email is sent to all the users of the groups.
From is optional. If missing the email is sent from the default email address configured in Jira. To pass the language specify the 'sender', 'to', 'cc', 'subject', 'body' and finally the 'language', as a string (for instance "en", "fr", "en_US", "ro", and so on). However, this is relevant only if you use templates as they support localization.
For example, an email sent with language "en" will look for templates in the folder called "en", inside the default template directory. If no such template is found, it will use the one in the default directory.
Also, starting with katl-commons-1.1.1, a default template placed in the default directory is mandatory for each template name used in your SIL programs. For example, if you want to use a template "t.tpl" using language "en_US", it is not only necessary to have "t.tpl" in the "en_US" folder, but you have to have a file "t.tpl" in the default directory.
If you don't specify the language parameter and you use templates, by default the messages are sent in the sender defined language. For the users that are Jira users ('to' or 'cc' are user names and not email addresses) the language defined in the user profile(for each user) is used for email sending. For the rest of the users the email is sent using the sender defined language.
...
Table plus | ||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||||||||||||||||||||||||||||||
|
Return Type
Examples
Example 1
...
Here is the same example that includes adding attachments to the email. This requires the use of the JEmailAttachment structure type.
Code Block |
---|
JEmailMessage email;
email.to = {"testJiraUser1", "testEmail@cprime.com", "testJiraUser2"};
email.subject = "Email to Santa";
email.message = "Dear Santa, I want a train.";
for(string a in attach) {
JEmailAttachment att;
att.name = a;
att.file = getAttachmentPath(key, a);
email.attachments += att;
}
sendEmail(email); |
See also
Filter by label (Content by label) | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|