Skip to content

Tenant-Wise Email Sender Configuration

This page demonstrates how to setup the email notification configurations tenant-wise.

Warning

To use this feature, apply the 0174 and 0196 WUM updates for WSO2 Identity Server 5.9.0 using the WSO2 Update Manager (WUM). To deploy a WUM update into production, you need to have a paid subscription. If you do not have a paid subscription, you can use this feature with the next version of WSO2 Identity Server when it is released. For more information on updating WSO2 Identity Server using WUM, see Updating WSO2 Products.

When handling notifications such as the ones given below, the email-sender configuration needs to be changed in <IS-HOME>/repository/conf/deployment.toml.

Email configurations

[output_adapter.email]
from_address= "[email protected]"
username= "wso2iamtest"
password= "Wso2@iam70"
hostname= smtp.gmail.com
port= 587
enable_start_tls= true
enable_authentication= true
However, this configuration will apply to all the tenants. If you wish to configure them tenant-wise follow the instructions given below instead.

  1. Configure the Configuration Management REST API.
  2. Execute the following curl command for creating a resource type named Publisher.

    Sample Request

    curl -X POST "https://localhost:9443/t/{tenant-domain}/api/identity/config-mgt/v1.0/resource-type" -H "accept: 
    application/json" -H 
    "Content-Type: application/json" -H 'Authorization: Basic YWRtaW46YWRtaW4=' -d "{ \"name\": \"Publisher\", \"description\": \"Publisher Configurations\"}"
    3. Execute the following curl command for creating a resource named EmailPublisher.

    Sample Request

    curl -X POST "https://localhost:9443/t/{tenant-domain}/api/identity/config-mgt/v1.0/resource/Publisher" -H "accept: 
    application/json" -H "Content-Type: application/json" -H 'Authorization: Basic YWRtaW46YWRtaW4=' -d "{ \"name\": \"EmailPublisher\", \"attributes\": [ { \"key\": \"email\", \"value\": \"string\" } ]}"
    4. Execute the following curl command for creating a file named EmailPublisher.

    Sample Request

    curl -X POST "https://localhost:9443/t/{tenant-domain}/api/identity/config-mgt/v1
    .0/resource/Publisher/EmailPublisher/file" -H "accept: application/json" -H 
    "Content-Type: multipart/form-data" -H 'Authorization: Basic YWRtaW46YWRtaW4=' -F "[email protected];type=text/xml" -F "fileName=EmailPublisher"
    This EmailPublisher.xml file will be used as the tenant's email publisher file. We can configure the tenant wise email configurations here.

    Configurable parameters are given below.

    Property name

    Description

    mail.smtp.user User Name for the sender smtp server
    mail.smtp.password

    Password for the sender smtp server

    mail.smtp.port

    Port of the sender smtp server

    mail.smtp.from From email address of the smtp server
    mail.smtp.host Host name of the smtp server
    mail.smtp.auth Password hash method to use when storing user entries in the user store.
    mail.smtp.starttls.enable Property to enable STARTTLS support for JavaMail
    mail.smtp.replyTo Reply to address of smtp server
    mail.smtp.signature Signature for the sender account

    Following is a sample configuration for the EmailPublisher.xml file.

    Sample Email Publisher
    <?xml version="1.0" encoding="UTF-8"?>
    <eventPublisher name="EmailPublisher" statistics="disable"
      trace="disable" xmlns="http://wso2.org/carbon/eventpublisher">
      <from streamName="id_gov_notify_stream" version="1.0.0"/>
      <mapping customMapping="enable" type="text">
        <inline>{{body}}{{footer}}</inline>
      </mapping>
      <to eventAdapterType="email">
        <property name="email.address">{{send-to}}</property>
        <property name="email.type">{{content-type}}</property>
        <property name="email.subject">{{subject}}</property>
        <property name="mail.smtp.password">xxxxx</property>
        <property name="mail.smtp.from">[email protected]</property>
        <property name="mail.smtp.user">resourcesiam</property>
      </to>
    </eventPublisher>

    Note

    You do not need to configure all the configurable parameters. If a parameter has not been configured in the EmailPublisher.xml file, configurations in the output-event-adapters.xml will be used instead.

  3. Since these configurations will be applicable during the tenant loading process, Configure tenant loading and unloading for your tenant.

    Tip

    Only one EmailPublisher.xml file with the name EmailPublisher should be added for a tenant.

Top