Send emails directly from the dial plan

To easily work with almost all email servers you will need the Integration Server (IS) – free of charge and easy to install application server that extends Asterisk dial plan functionality. IS Email module provides functionality to ease access third party email servers like Google, Exim, Exchange server, and send emails directly from the Asterisk dial plan.

The Visual Dialplan building block that is used for this purpose is the SendMail block (located at the Integration Server sheet in Visual Dialplan).
In the next five steps you will be explained how to successfully install and use Integration Server email module:

1. Installation process and firewall rules
2. Create connection to the email server
3. Email template editor
4. SendMail component
5. Create email drive dial plan

1. Installation process and firewall rules

There are two ways to install Integration Server.
The first way is to download Visual Dialplan from (free download) and install Integration Server together with Visual Dialplan. Simply check the Embedded Integration Server box during the installation process and Integration Server will be installed.
The second way is to download and install Integration server separately. Integration Server can be downloaded for free from: .

Integration server use the following ports, so make sure there ports are opened at firewall:

– 9110 default port for direct access from Visual Dialplan
– 9111 Integration Server HTTP interface
– 9112 default port for embedded database server
– 9113 default port for embedded email server

2. Create connection to the email server

To create connection to the Email (SMTP) server you should first create connection to the Integration Server, assuming you already installed Integration Server. You can also use already created connection to the Integration Server you installed during the Visual Dialplan installation (in case you have selected option to install Integration Server while installing Visual Dialplan).

To create new connection right click on the area on the left side and selecting “New Integration Server …” option from the drop down menu. Fill in the Name, Host, Username and Password information and test connection to the Integration Server.

Default Integration Server Username is admin, and default password is also admin.


Now you should create connection to the Email server.
Right click on the Email resource node to choose “New email server” from the drop down menu.


Fill in the information about your gmail account (the window above shows connection to Gmail server) and click on the “Test connection” button to make sure the connection works correctly.

3. Email template editor

This is the place where email templates should be defined.
Once the email template is defined it can be used to send multiple emails.
Simply type the message in the email template body, fill standard email parameters like Subject, From , To, BCC, CC and click on the “Send email…” button, and email will be sent.


You can create as many email templates as you wish.
Just right click on the “Templates” node and select “New Email Template” from the drop down menu to create new template.

You can also use parameters (dial plan variables) within email template.

At the design time (while you work in email templates editor) you can set values for the variables.
For example if you want to assign number 123 to variable pin you should have the following line in your email template:

At run time (when call arrives at Asterisk) this value will be replaced with the real pin variable value from the Asterisk dial plan.
This mean you should define this variable in your dial plan and assign some value to it in the dial plan.

Here is an example.

— This is the comment.
— The following line is parameter definition used only at the design time.
— When you send email via email template editor
— the parameter ${pin} will be replaced with number 123.
— At runtime ${pin} will be replaced with Asterisk variable ${pin} value.
Welcome to the Apstel Dialplan Integration Server for Asterisk.<br>
You have entered PIN: <b>${pin}</b>.
Best regards,<br>
Apstel Team

Besides standard email parameters like Subject, From, To, CC and BCC fields there is also ability to set email priority (Low, Normal, High) and email type (HTML or plain text).
Before using the email template make sure to preview it in Visual Dialplan using the Preview panel, or preview it in your default web browser by clicking on the Preview in browser button, or send a test email by manually clicking on the Send email button.
Now let’s see how to use this in the dial plan.

4. SendMail component

This is powerful component that enables access to the SMTP (email) server from the dial plan.
The component is located on the Integration Server sheet.

SendMail component connects to the Integration Server that further connects to the email server, authenticates, sends email and disconnects from the server.


You are now ready to create your fist email drive dial plan.

5. Create email drive dial plan 

In this sample we will show you how to send email from the dial plan. We will use “is-email.vdp” sample dial plan provided with the Visual Dialplan (select “Open sample dial plan” at Quick start window when starting Visual Dialplan).

This simple dial plan is created to work with email server automatically installed when you installed Integration Server.

Here are the steps we took to create this dial plan:
1) In IS view under the Embedded Email Server open Welcome template.


2) Create the dial plan context that will send email:
a. The first building block starts the dial plan and defines the DID (extension) that will be handled by this dial plan
b. Second building block reads entered DTMF digits and stores it into variable “pin”, previously created in Channel Variable view.
c. Third building block sends email
d. Fourth (latest) building block hangs up the call


3) Edit SendMail component:
a. Select Embedded IS,
b. Select embedded email server,
c. Select “welcome” email template

This dial plan will send “welcome” email message from to with the following subject “Welcome to Dialplan Integration Server”.

That’s it.
You need just one building block to send emails from your dial plan, simple as that!