Configure the email settings to send out registration confirmation emails to new users and invite existing users to register their device with WSO2 IoT Server.
In WSO2 IoT Server, user registration confirmation emails are disabled by default, and the admin needs to provide the required configuration details to enable it.
Create an email account to send out emails to users that register with WSO2 IoT Server (e.g., [email protected]).
Open the
<IoTS_HOME>/conf/axis2/axis2.xml
file, uncomment themailto
transportSender
section, and configure the WSO2 IoT Server email account.<transportSender name="mailto" class="org.apache.axis2.transport.mail.MailTransportSender"> <parameter name="mail.smtp.host">smtp.gmail.com</parameter> <parameter name="mail.smtp.port">587</parameter> <parameter name="mail.smtp.starttls.enable">true</parameter> <parameter name="mail.smtp.auth">true</parameter> <parameter name="mail.smtp.user">synapse.demo.0</parameter> <parameter name="mail.smtp.password">mailpassword</parameter> <parameter name="mail.smtp.from">[email protected]</parameter> </transportSender>
For
mail.smtp.user
,mail.smtp.password
, andmail.smtp.from,
use the username, password, and email address (respectively) from the email account you set up.Example:
<transportSender name="mailto" class="org.apache.axis2.transport.mail.MailTransportSender"> <parameter name="mail.smtp.host">smtp.gmail.com</parameter> <parameter name="mail.smtp.port">587</parameter> <parameter name="mail.smtp.starttls.enable">true</parameter> <parameter name="mail.smtp.auth">true</parameter> <parameter name="mail.smtp.user">no-reply</parameter> <parameter name="mail.smtp.password">$foo1234</parameter> <parameter name="mail.smtp.from">[email protected]</parameter> </transportSender>
After updating the Axis2 configurations, restart the core profile.
Optionally, configure the email sender thread pool.
Navigate to theemail-sender-config.xml
file, which is in the<IOTS_HOME>/conf/etc
directory, and configure the following fields under<EmailSenderConfig>
.MinThreads
: Defines the minimum number of threads that need to be available in the underlying thread pool when the email sender functionality is initialized.MaxThreads
: Defines the maximum number of threads that should serve email sending at any given time.KeepAliveDuration
: Defines the duration that a connection should be kept alive. If the thread pool has initialized more connections than what was defined inMinThreads
, and they have been idle for more than theKeepAliveDuration
, those idle connections will be terminatedThreadQueueCapacity
: Defines the maximum concurrent email sending tasks that can be queued up.
Example:
<EmailSenderConfig> <MinThreads>8</MinThreads> <MaxThreads>100</MaxThreads> <KeepAliveDuration>20</KeepAliveDuration> <ThreadQueueCapacity>1000</ThreadQueueCapacity> </EmailSenderConfig>
Optionally, customize the email templates that are in the
<IoTS_HOME>/repository/resources/email-templates
directory.The email templating functionality of WSO2 IoT Server is implemented on top of Apache Velocity, which is a free and open-source template engine.
- Open the email template that you wish to edit based on the requirement, such as the
user-enrollment.vm
oruser-registration.vm
file. - Edit the
<Subject>
and<Body>
to suit your requirement.
- If you need to access
HTTP
orHTTPS
base URLs of the server within your custom template configs, use the$base-url-http
and$base-url-https
variables, respectively. - You can update the look and feel of the email template via the WSO2 IoT Server management console too. For more information, see Customizing Email Templates for Tenants.
- Open the email template that you wish to edit based on the requirement, such as the