This server-side class serves for the implementation of the email objects for applications; in addition to these methods, use the email global object available in the notification scriptsЭтот серверный класс служит для взаимодействия с объектом электронной почты в скриптах уведомлений. В дополнение к этим методам используйте глобальный объект электронной почты, доступный в скриптах уведомлений.
addAddress(address, displayName)
This method populates the To field of the Email Используйте этот метод, чтобы добавить указанный электронный адрес в поле Кому записи таблицы Электронная почта(sys_email) table record with the address specified.
Parameter(s)Параметры:
NameTypeMandatory | Default ValueОбязательный | Значение по умолчанию |
---|
address | String |
YN or NullN'NULL' | Возвращаемое значениеReturn:
DescriptionThis method does not return a valueМетод не возвращает значение. |
ExampleПример:
Code Block |
---|
language | js |
---|
theme | Eclipse |
---|
title | addAddress() |
---|
linenumbers | true |
---|
|
(function runNotificationScript(
/* SimpleRecord */ current,
/* SimpleTemplatePrinter */ template,
/* SimpleEmailOutbound */ email,
/* SimpleRecord */ event
) {
email.addAddress(current.caller.email, current.caller.display_name);
})(current, template, email, event); |
addAddressBcc(address, displayName)
This method populates the Blind Carbon Copy (BCC) field of the Email (Используйте метод для добавления указанного электронного адреса в поле Скрытая копия записи таблицы Электронная почта(sys_email) table record with the address specified.
Parameter(s)Параметры:
NameTypeMandatory | Default ValueОбязательный | Значение по умолчанию |
---|
address | String |
YN or NullN'NULL' | Возвращаемое значениеReturn:
TypeDescriptionThis method does not return a valueМетод не возвращает значение. |
ExampleПример:
Code Block |
---|
language | js |
---|
theme | Eclipse |
---|
title | addAddressBcc() |
---|
linenumbers | true |
---|
|
(function runNotificationScript(
/* SimpleRecord */ current,
/* SimpleTemplatePrinter */ template,
/* SimpleEmailOutbound */ email,
/* SimpleRecord */ event
) {
if (+event.param_2 > 1000) {
email.addAddressBcc(
current.assigned_user.manager.email,
current.assigned_user.manager.display_name
);
}
})(current, template, email, event); |
addAddressCc(address, displayName)
This method populates the Carbon Copy (CC) field of the Email (Используйте этот метод, чтобы добавить указанный электронный адрес в поле Копия записи таблицы Электронная почта(sys_email) table record with the address specified.
Parameter(s)Параметры:
NameTypeMandatory | Default ValueОбязательный | Значение по умолчанию |
---|
address | String |
YN or NullN'NULL' | Возвращаемое значениеReturn:
TypeDescriptionThis method does not return a valueМетод не возвращает значение. |
ExampleПример:
Code Block |
---|
language | js |
---|
theme | Eclipse |
---|
title | addAddressCc() |
---|
linenumbers | true |
---|
|
(function runNotificationScript(
/* SimpleRecord */ current,
/* SimpleTemplatePrinter */ template,
/* SimpleEmailOutbound */ email,
/* SimpleRecord */ event
) {
email.addAddressCc('john.doe@example.com', 'John Doe'
current.assigned_user.manager.email,
current.assigned_user.manager.display_name
);
})(current, template, email, event); |
getAddresses()
This method gets the recipients' addresses.
Return:
Type | Description |
---|
String | A string containing the recipient's addresses. |
Используйте этот метод, чтобы получить адреса получателей.
Возвращаемое значение:
Тип | Описание |
---|
Array of Strings | Метод возвращает массив строк с электронными адресами получателей. |
ПримерExample:
Code Block |
---|
language | js |
---|
theme | Eclipse |
---|
title | getAddresses() |
---|
linenumbers | true |
---|
|
(function runNotificationScript(
/* SimpleRecord */ current,
/* SimpleTemplatePrinter */ template,
/* SimpleEmailOutbound */ email,
/* SimpleRecord */ event
) {
email.getAddresses();
})(current, template, email, event); |
getAddressesBcc()
This method gets the recipients' BCC addresses.
Return:
Type | Description |
---|
String | A string containing the recipient's BCC addresses. |
Используйте этот метод, чтобы получить адреса получателей, указанных в Скрытой копии письма.
Возвращаемое значение:
Тип | Описание |
---|
Array of Strings | Метод возвращает массив строк с адресами получателей Скрытой копии. |
ПримерExample:
Code Block |
---|
language | js |
---|
theme | Eclipse |
---|
title | getAddressesBcc() |
---|
linenumbers | true |
---|
|
(function runNotificationScript(
/* SimpleRecord */ current,
/* SimpleTemplatePrinter */ template,
/* SimpleEmailOutbound */ email,
/* SimpleRecord */ event
) {
email.getAddressesBcc();
})(current, template, email, event); |
getAddressesCc()
This method gets the recipients' CC addresses.
Return:
Type | Description |
---|
String | A string containing the recipient's CC addresses. |
Используйте этот метод, чтобы получить адреса получателей, указанных в Копии письма.
Возвращаемое значение:
Тип | Описание |
---|
Array of Strings | Метод возвращает массив строк с адресами получателей, указанных в Копии письма. |
ПримерExample:
Code Block |
---|
language | js |
---|
theme | Eclipse |
---|
title | getAddressesCc() |
---|
linenumbers | true |
---|
|
(function runNotificationScript(
/* SimpleRecord */ current,
/* SimpleTemplatePrinter */ template,
/* SimpleEmailOutbound */ email,
/* SimpleRecord */ event
) {
email.getAddressesCc();
})(current, template, email, event); |
getBody()
This method gets the message body.
Return:
Type | Description |
---|
String | The message body. |
Используйте этот метод для получения текста письма.
Возвращаемое значение:
Тип | Описание |
---|
String | Метод возвращает текст письма. |
ПримерExample:
Code Block |
---|
language | js |
---|
theme | Eclipse |
---|
title | getBody() |
---|
linenumbers | true |
---|
|
(function runNotificationScript(
/* SimpleRecord */ current,
/* SimpleTemplatePrinter */ template,
/* SimpleEmailOutbound */ email,
/* SimpleRecord */ event
) {
email.getBody();
})(current, template, email, event); |
getFrom()
This method gets the sender's address.
Return:
Type | Description |
---|
String | A string containing the sender's address. |
Используйте этот метод, чтобы получить адрес отправителя.
Возвращаемое значение:
Тип | Описание |
---|
String | Метод возвращает адрес отправителя. |
ПримерExample:
Code Block |
---|
language | js |
---|
theme | Eclipse |
---|
title | getForm() |
---|
linenumbers | true |
---|
|
(function runNotificationScript(
/* SimpleRecord */ current,
/* SimpleTemplatePrinter */ template,
/* SimpleEmailOutbound */ email,
/* SimpleRecord */ event
) {
email.getFrom();
})(current, template, email, event); |
getReplyTo()
This method gets the replyTo address.
Return:
Type | Description |
---|
String | A string containing the replyTo address. |
Используйте этот метод, чтобы получить адрес, указанный в поле Ответ.
Возвращаемое значение:
Тип | Описание |
---|
String | Метод возвращает адрес, указанный для ответа. |
ПримерExample:
Code Block |
---|
language | js |
---|
theme | Eclipse |
---|
title | getReplyTo() |
---|
linenumbers | true |
---|
|
(function runNotificationScript(
/* SimpleRecord */ current,
/* SimpleTemplatePrinter */ template,
/* SimpleEmailOutbound */ email,
/* SimpleRecord */ event
) {
email.getReplyTo();
})(current, template, email, event); |
getSubject()
This method returns the subject of a message.
Return:
Type | Description |
---|
String | A string containing the message subject line. |
Используйте этот метод, чтобы получить тему письма.
Возвращаемое значение:
Тип | Описание |
---|
String | Метод возвращает тему письма. |
ПримерExample:
Code Block |
---|
language | js |
---|
theme | Eclipse |
---|
title | getSubject() |
---|
linenumbers | true |
---|
|
(function runNotificationScript(
/* SimpleRecord */ current,
/* SimpleTemplatePrinter */ template,
/* SimpleEmailOutbound */ email,
/* SimpleRecord */ event
) {
email.getSubject();
})(current, template, email, event); |
setBody(bodyText)
This method sets the body of a message.
Parameter(s):
Используйте этот метод, чтобы задать текст письма в поле Обычный текст.
Параметры:
Название | Тип | Обязательный | Значение по умолчанию |
---|
Name | Type | Mandatory | Default ValueYNReturnВозвращаемое значение:
TypeDescriptionThis method does not return a valueМетод не возвращает значение. |
ExampleПример:
Code Block |
---|
language | js |
---|
theme | Eclipse |
---|
title | setBody() |
---|
linenumbers | true |
---|
|
(function runNotificationScript(
/* SimpleRecord */ current,
/* SimpleTemplatePrinter */ template,
/* SimpleEmailOutbound */ email,
/* SimpleRecord */ event
) {
email.setBody(`Additional`Дополнительные commentsкомментарии:
${current.sys_updated_by.display_name}: "${current.additional_comments}"`
);
})(current, template, email, event); |
setFrom(address)
By default, the outgoing email From field contains the address taken from the From field of the default email account. Use the setFrom(address) method to change the From field value of an outgoing email.
Используйте метод, чтобы изменить значение адреса отправителя в поле От кого исходящего письма. По умолчанию значение поля От кого исходящего письма берётся из поля От кого дефолтного почтового аккаунта.
Данный метод не позволяет изменить почтовый аккаунт для исходящего письма. Для изменения почтового аккаунта по умолчанию измените значение системного свойства defaultIt is impossible to change the email account for the outgoing email with this method. To change the default email account, change the value of the system property default.email.account.send.
The value of the argument must be valid for the regular expression set in the Значение параметра метода должно соответствовать регулярному выражению, заданному в свойстве email.validation.reg_exp property.
Regardless of the value in the Form field of an outgoing email, the system conducts the sending authorization with the data set in the default email account.
Parameter(s):
.
Вне зависимости от значения поля От кого исходящего письма, система проводит авторизацию отправки с данными, установленными в почтовом аккаунте по умолчанию.
Параметры:
Название | Тип | Обязательный | Значение по умолчанию |
---|
Name | Type | Mandatory | Default ValueYNReturnВозвращаемое значение:
TypeDescriptionThis method does not return a valueМетод не возвращает значение. |
ExampleПример:
Code Block |
---|
language | js |
---|
theme | Eclipse |
---|
title | setFrom() |
---|
linenumbers | true |
---|
|
(function runNotificationScript(
/* SimpleRecord */ current,
/* SimpleTemplatePrinter */ template,
/* SimpleEmailOutbound */ email,
/* SimpleRecord */ event
) {
email.setFrom('test@example.com');
})(current, template, email, event); |
setReplyTo(address)
This method sets the replyTo address. The argument value of the method must be valid for the regular expression, set in the Используйте метод, чтобы установить адрес в поле Ответ. Значение переданного параметра должно соответствовать регулярному выражению, заданному в свойстве email.validation.reg_exp property.
Parameter(s)Параметры:
NameTypeMandatory | Default ValueОбязательный | Значение по умолчанию |
---|
address | String |
YN ReturnВозвращаемое значение:
TypeDescriptionThis method does not return a valueМетод не возвращает значение. |
ExampleПример:
Code Block |
---|
language | js |
---|
theme | Eclipse |
---|
title | setReplyTo() |
---|
linenumbers | true |
---|
|
(function runNotificationScript(
/* SimpleRecord */ current,
/* SimpleTemplatePrinter */ template,
/* SimpleEmailOutbound */ email,
/* SimpleRecord */ event
) {
email.setReplyTo('test@example.com');
})(current, template, email, event); |
setSubject(subject)
This method sets the subject of an email.
Parameter(s):
Используйте этот метод, чтобы установить тему письма.
Параметры:
Название | Тип | Обязательный | Значение по умолчанию |
---|
Name | Type | Mandatory | Default ValueYNReturnВозвращаемое значение:
TypeDescriptionThis method does not return a valueМетод не возвращает значение. |
ExampleПример:
Code Block |
---|
language | js |
---|
theme | Eclipse |
---|
title | setSubject() |
---|
linenumbers | true |
---|
|
(function runNotificationScript(
/* SimpleRecord */ current,
/* SimpleTemplatePrinter */ template,
/* SimpleEmailOutbound */ email,
/* SimpleRecord */ event
) {
email.setSubject('AdditionalПоявились comments have been added');
email.setBody(`Additional comments:
${current.sys_updated_by.display_name}: "${current.additional_comments}"`
новые комментарии');
})(current, template, email, event); |