diff --git a/en/identity-server/5.10.0/docs/references/adaptive-authentication-js-api-reference.md b/en/identity-server/5.10.0/docs/references/adaptive-authentication-js-api-reference.md index 03a1d98423..3808941d21 100644 --- a/en/identity-server/5.10.0/docs/references/adaptive-authentication-js-api-reference.md +++ b/en/identity-server/5.10.0/docs/references/adaptive-authentication-js-api-reference.md @@ -215,16 +215,30 @@ following parameters. |-----------------------|--------------------------------------------------------------------------------------------------------| | user | An object representing the user details. | | templateId | Identifier of the email template. The email template specifies the body of the email that is sent out. | -| placeholderParameters | Used to replace any placeholders in the template. | +| placeholderParameters | Used to replace any placeholders in the template.

This parameter also supports the following optional fields:
| **Example code** +Send an email to an existing user: + ``` java var user = context.steps[1].subject; var firstName = user.localClaims['http://wso2.org/claims/givenname']; sendEmail(user, 'myTemplate', {'firstName':firstName}); ``` +Send an email to a non-existent user: + +``` java +var email = 'user@example.com'; +var otp = '123456'; +var sent = sendEmail(context.currentKnownSubject, 'EmailOTP', { + 'send-to': email, + 'flowType': 'registration', + 'OTPCode': otp +}); +``` + ##### sendError(url,parameters) This function redirects the user to an error page. It includes the diff --git a/en/identity-server/5.11.0/docs/references/adaptive-authentication-js-api-reference.md b/en/identity-server/5.11.0/docs/references/adaptive-authentication-js-api-reference.md index 8481903089..18864e2ee4 100644 --- a/en/identity-server/5.11.0/docs/references/adaptive-authentication-js-api-reference.md +++ b/en/identity-server/5.11.0/docs/references/adaptive-authentication-js-api-reference.md @@ -242,16 +242,30 @@ following parameters. |-----------------------|--------------------------------------------------------------------------------------------------------| | user | An object representing the user details. | | templateId | Identifier of the email template. The email template specifies the body of the email that is sent out. | -| placeholderParameters | Used to replace any placeholders in the template. | +| placeholderParameters | Used to replace any placeholders in the template.

This parameter also supports the following optional fields:
| **Example code** +Send an email to an existing user: + ``` java var user = context.steps[1].subject; var firstName = user.localClaims['http://wso2.org/claims/givenname']; sendEmail(user, 'myTemplate', {'firstName':firstName}); ``` +Send an email to a non-existent user: + +``` java +var email = 'user@example.com'; +var otp = '123456'; +var sent = sendEmail(context.currentKnownSubject, 'EmailOTP', { + 'send-to': email, + 'flowType': 'registration', + 'OTPCode': otp +}); +``` + ##### sendError(url,parameters) This function redirects the user to an error page. It includes the diff --git a/en/identity-server/5.9.0/docs/references/adaptive-authentication-js-api-reference.md b/en/identity-server/5.9.0/docs/references/adaptive-authentication-js-api-reference.md index 23dc96763d..5355737c5c 100644 --- a/en/identity-server/5.9.0/docs/references/adaptive-authentication-js-api-reference.md +++ b/en/identity-server/5.9.0/docs/references/adaptive-authentication-js-api-reference.md @@ -215,16 +215,30 @@ following parameters. |-----------------------|--------------------------------------------------------------------------------------------------------| | user | An object representing the user details. | | templateId | Identifier of the email template. The email template specifies the body of the email that is sent out. | -| placeholderParameters | Used to replace any placeholders in the template. | +| placeholderParameters | Used to replace any placeholders in the template.

This parameter also supports the following optional fields:
| **Example code** +Send an email to an existing user: + ``` java var user = context.steps[1].subject; var firstName = user.localClaims['http://wso2.org/claims/givenname']; sendEmail(user, 'myTemplate', {'firstName':firstName}); ``` +Send an email to a non-existent user: + +``` java +var email = 'user@example.com'; +var otp = '123456'; +var sent = sendEmail(context.currentKnownSubject, 'EmailOTP', { + 'send-to': email, + 'flowType': 'registration', + 'OTPCode': otp +}); +``` + ##### sendError(url,parameters) This function redirects the user to an error page. It includes the diff --git a/en/identity-server/6.0.0/docs/references/adaptive-authentication-js-api-reference.md b/en/identity-server/6.0.0/docs/references/adaptive-authentication-js-api-reference.md index 0c3d3a3cf2..ead85d2f02 100644 --- a/en/identity-server/6.0.0/docs/references/adaptive-authentication-js-api-reference.md +++ b/en/identity-server/6.0.0/docs/references/adaptive-authentication-js-api-reference.md @@ -233,7 +233,9 @@ following parameters. |-----------------------|--------------------------------------------------------------------------------------------------------| | user | An object representing the user details. | | templateId | Identifier of the email template. The email template specifies the body of the email that is sent out. | -| placeholderParameters | Used to replace any placeholders in the template. | +| placeholderParameters | Used to replace any placeholders in the template.

This parameter also supports the following optional fields:
| + +Send an email to an existing user: ``` java var user = context.steps[1].subject; @@ -241,6 +243,18 @@ var firstName = user.localClaims['http://wso2.org/claims/givenname']; sendEmail(user, 'myTemplate', {'firstName':firstName}); ``` +Send an email to a non-existent user: + +``` java +var email = 'user@example.com'; +var otp = '123456'; +var sent = sendEmail(context.currentKnownSubject, 'EmailOTP', { + 'send-to': email, + 'flowType': 'registration', + 'OTPCode': otp +}); +``` + #### sendError(url,parameters) This function redirects the user to an error page. It includes the diff --git a/en/identity-server/6.1.0/docs/references/adaptive-authentication-js-api-reference.md b/en/identity-server/6.1.0/docs/references/adaptive-authentication-js-api-reference.md index eb8ab4c692..00b5effdbc 100644 --- a/en/identity-server/6.1.0/docs/references/adaptive-authentication-js-api-reference.md +++ b/en/identity-server/6.1.0/docs/references/adaptive-authentication-js-api-reference.md @@ -272,7 +272,9 @@ following parameters. |-----------------------|--------------------------------------------------------------------------------------------------------| | user | An object representing the user details. | | templateId | Identifier of the email template. The email template specifies the body of the email that is sent out. | -| placeholderParameters | Used to replace any placeholders in the template. | +| placeholderParameters | Used to replace any placeholders in the template.

This parameter also supports the following optional fields:
| + +Send an email to an existing user: ``` java var user = context.steps[1].subject; @@ -280,6 +282,18 @@ var firstName = user.localClaims['http://wso2.org/claims/givenname']; sendEmail(user, 'myTemplate', {'firstName':firstName}); ``` +Send an email to a non-existent user: + +``` java +var email = 'user@example.com'; +var otp = '123456'; +var sent = sendEmail(context.currentKnownSubject, 'EmailOTP', { + 'send-to': email, + 'flowType': 'registration', + 'OTPCode': otp +}); +``` + #### sendError(url,parameters) This function redirects the user to an error page. It includes the diff --git a/en/identity-server/7.0.0/docs/references/conditional-auth/api-reference.md b/en/identity-server/7.0.0/docs/references/conditional-auth/api-reference.md index 4abaf42112..fb57267f40 100644 --- a/en/identity-server/7.0.0/docs/references/conditional-auth/api-reference.md +++ b/en/identity-server/7.0.0/docs/references/conditional-auth/api-reference.md @@ -688,19 +688,39 @@ This function sends an email to the specified user. It includes the parameters l placeholderParameters - Used to replace any placeholders in the template. +

Used to replace any placeholders in the template.

+

This parameter also supports the following optional fields:

+ + - **Example** + Send an email to an existing user: + ``` js var user = context.steps[1].subject; var firstName = user.localClaims['http://wso2.org/claims/givenname']; sendEmail(user, 'myTemplate', {'firstName':firstName}); ``` + Send an email to a non-existent user: + + ``` js + var email = 'user@example.com'; + var otp = '123456'; + var sent = sendEmail(context.currentKnownSubject, 'EmailOTP', { + 'send-to': email, + 'flowType': 'registration', + 'OTPCode': otp + }); + ``` + ### Get parameter value from JWT `getValueFromDecodedAssertion(jwt, parameterName, isParameterInPayload)` diff --git a/en/identity-server/7.1.0/docs/references/conditional-auth/api-reference.md b/en/identity-server/7.1.0/docs/references/conditional-auth/api-reference.md index 5bbd6d6b4e..3f5ed78870 100644 --- a/en/identity-server/7.1.0/docs/references/conditional-auth/api-reference.md +++ b/en/identity-server/7.1.0/docs/references/conditional-auth/api-reference.md @@ -690,19 +690,39 @@ This function sends an email to the specified user. It includes the parameters l placeholderParameters - Used to replace any placeholders in the template. +

Used to replace any placeholders in the template.

+

This parameter also supports the following optional fields:

+ + - **Example** + Send an email to an existing user: + ``` js var user = context.steps[1].subject; var firstName = user.localClaims['http://wso2.org/claims/givenname']; sendEmail(user, 'myTemplate', {'firstName':firstName}); ``` + Send an email to a non-existent user: + + ``` js + var email = 'user@example.com'; + var otp = '123456'; + var sent = sendEmail(context.currentKnownSubject, 'EmailOTP', { + 'send-to': email, + 'flowType': 'registration', + 'OTPCode': otp + }); + ``` + ### Get parameter value from JWT `getValueFromDecodedAssertion(jwt, parameterName, isParameterInPayload)` diff --git a/en/identity-server/7.2.0/docs/references/conditional-auth/api-reference.md b/en/identity-server/7.2.0/docs/references/conditional-auth/api-reference.md index 7d22748f94..fcc22ec66c 100644 --- a/en/identity-server/7.2.0/docs/references/conditional-auth/api-reference.md +++ b/en/identity-server/7.2.0/docs/references/conditional-auth/api-reference.md @@ -694,19 +694,39 @@ This function sends an email to the specified user. It includes the parameters l placeholderParameters - Used to replace any placeholders in the template. +

Used to replace any placeholders in the template.

+

This parameter also supports the following optional fields:

+ + - **Example** + Send an email to an existing user: + ``` js var user = context.steps[1].subject; var firstName = user.localClaims['http://wso2.org/claims/givenname']; sendEmail(user, 'myTemplate', {'firstName':firstName}); ``` + Send an email to a non-existent user: + + ``` js + var email = 'user@example.com'; + var otp = '123456'; + var sent = sendEmail(context.currentKnownSubject, 'EmailOTP', { + 'send-to': email, + 'flowType': 'registration', + 'OTPCode': otp + }); + ``` + ### Get parameter value from JWT `getValueFromDecodedAssertion(jwt, parameterName, isParameterInPayload)` diff --git a/en/identity-server/next/docs/references/conditional-auth/api-reference.md b/en/identity-server/next/docs/references/conditional-auth/api-reference.md index 7d22748f94..fcc22ec66c 100644 --- a/en/identity-server/next/docs/references/conditional-auth/api-reference.md +++ b/en/identity-server/next/docs/references/conditional-auth/api-reference.md @@ -694,19 +694,39 @@ This function sends an email to the specified user. It includes the parameters l placeholderParameters - Used to replace any placeholders in the template. +

Used to replace any placeholders in the template.

+

This parameter also supports the following optional fields:

+ + - **Example** + Send an email to an existing user: + ``` js var user = context.steps[1].subject; var firstName = user.localClaims['http://wso2.org/claims/givenname']; sendEmail(user, 'myTemplate', {'firstName':firstName}); ``` + Send an email to a non-existent user: + + ``` js + var email = 'user@example.com'; + var otp = '123456'; + var sent = sendEmail(context.currentKnownSubject, 'EmailOTP', { + 'send-to': email, + 'flowType': 'registration', + 'OTPCode': otp + }); + ``` + ### Get parameter value from JWT `getValueFromDecodedAssertion(jwt, parameterName, isParameterInPayload)`