Skip to main content

Email

The Email action allows your bot to send emails to the specified email address.

tip
You don’t need to have a configured mail server to send messages using the Email tag. However, all messages will have aimylogic_notification@just-ai.com as their sender. This behavior cannot be changed. If you want to connect your own SMTP server, use the $mail built-in service instead.

Parameters

ParameterTypeDescriptionRequired
destinationStringRecipient address.Yes
subjectStringMessage subject.Yes
textStringMessage body.
If you want to use HTML markup, leave this parameter empty (prompt =) and fill out the html parameter value instead.
Yes
filesArray of objectsAttached files. Use the following format for the value:
files =
[{
"name": "File name",
"url": "File link"
}]
No
htmlStringMessage body with HTML markup.
If you don’t intend to use HTML markup, omit this parameter and use text only.
No
htmlEnabledBooleanIf set to true, the message body will use the html parameter value.
If omitted or set to false, the prompt value will be used.
No
okStateStringThe state the dialog will switch to if the tag script finishes without errors.No
errorStateStringThe state the dialog will switch to if the tag script fails: for example, if you specify invalid parameter values.No

How to use

state: AttachDocument
InputFile:
prompt = Please upload the filled out data processing agreement to the chat.
varName = fileUrl
then = /SendDocument

state: SendDocument
Email:
destination = example@just-ai.com
subject = Data processing agreement
text =
files = [{"name": "document.pdf", "url": "{{$session.fileUrl}}"}]
html = Hello! Please find the filled out agreement attached to this message or use this <a href="{{$session.fileUrl}}">link</a>.
htmlEnabled = true
okState = /SendDocument/Success
errorState = /SendDocument/Failure

state: Success
a: The agreement has been successfully sent to the manager.

state: Failure
a: Sorry, email delivery failed.