Introduction
In this article we will explain how to send an e-mail message from
3CX Call Flow Designer using the Email Sender component. The application records the caller's voice in a WAV file and sends it as an e-mail attachment.
You can use this component, for example, to notify about the order of goods through the voice menu 3CX, and in other situations when the voice interaction of the user with the system must be accompanied by sending e-mail.
Recall that in previous articles we considered the creation of a
CFD application for outgoing dialing (after the call is completed, you can send a report using the Email Sender component),
CFD operation with databases (which can also be used to get a subscriber number) and
incoming call routing depending on time of day (which can be combined with outgoing calls)
')
Please note - the 3CX CFD development environment is free. But voice applications will be run only on
3CX Pro and Enterprise editions . Download CFD
from here .
The demo project of this voice application comes with the 3CX CFD distribution and is located in the
Documents \ 3CX Call Flow Designer Demos folder. To get started, it is enough to specify the parameters of your SMTP server in the demo application.
Project creation
To create a CFD project, go to
File → New → Project , specify the project folder and its name, for example,
EMailDemo .
Write user message to file
To begin, write the subscriber's message to a file. This file will then be sent to the e-mail. For this, the
Record component is used.
- Drag the Record component into the main development environment window (into the Main voice application). Go to the properties window and rename the component to recordYourMessage .
- Double click on the component and in the opened window set the following parameters:
CONCATENATE("CallFrom_",session.ani,".wav")
Sending a recorded message to e-mail
Now we will send the recorded audio file as an e-mail attachment. To do this, add the
E-Mail Sender component to the
Audio Recorded branch of the
Record component and configure it as shown below:
Note that in those parameters where expressions are specified (the fields have the
Fx button on the right), any specified constant must be quoted, since these fields may also contain variables or expression results.
For the
Subject parameter, we use an expression that adds the caller's number.
The Attachments
Attachments list contains file descriptions consisting of two columns:
- Name is the name of the file that the recipient of the e-mail message will see. We indicate here Recording.wav , so that only the file with this name comes in the attachment.
- File - an expression that indicates the physical file of the record that you want to attach to the letter. However, here we must supplement the expression that generates the file name (which was used in the previous step). In the previous step, the relative path to the file was used in the Record component - only the name was indicated. The file was created in the audio file directory of this project. The Email Sender component should be passed the full path to the file, so the expression is complemented by the variable session.audioFolder :
CONCATENATE(session.audioFolder,"/CallFrom_",session.ani,".wav")
Now the voice application correctly finds and inserts the audio file.
Compiling and installing the application on the 3CX server
Voice application is ready! Now it should be compiled and uploaded to the 3CX server. For this:
- Go to Build → Build All , and the CFD will create the EMailDemo.tcxvoiceapp file.
- Go to the 3CX management interface, in the Call Queues section. Create a new Call Queue, specify the name and extension number of the Queue, and then set the Voice Applications option and download the compiled file.
- Save your changes to the Call Queue. Voice application is ready to use.
