Skip to content

Tenant Wise Email Sender Configuration

When handling notifications such as,

We are configuring email-sender configurations by adding the following configuration to <IS-HOME>/repository/conf/deployment.toml file.

[output_adapter.email]
from_address= "wso2iamtest@gmail.com"
username= "wso2iamtest"
password= "Wso2@iam70"
hostname= smtp.gmail.com
port= 587
enable_start_tls= true
enable_authentication= true

But this configuration will apply to all the tenants. If you are having a requirement to configure them tenant wise please follow the following instructions.

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

    Sample Request

    curl -X POST "https://localhost/t/{tenant-domain}/api/identity/config-mgt/v1.0/resource-type" -H "accept: application/json" -H 
    "Content-Type: application/json" -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/t/{tenant-domain}/api/identity/config-mgt/v1.0/resource/Publisher" -H "accept: application/json" -H "Content-Type: application/json" -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/t/{tenant-domain}/api/identity/config-mgt/v1.0/resource/Publisher/EmailPublisher/file" -H "accept: application/json" -H 
    "Content-Type: multipart/form-data" -F "resourceFile=@EmailPublisher.xml;type=text/xml" -F "file-name=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 EmailPublisher.xml file.

    Note

    You do not need to configure all the configurable parameters. If you havent configured in the EmailPublisher.xml, Configurations in the output-event-adapters.xml will be used for unconfigured parameters.

  3. Configure tenant loading and unloading for your tenant. Configuring the Tenant Loading Policy

  4. These configurations will apply to the tenant loading process.

    Tip

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

Top