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 JAICP 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
Parameter | Type | Description | Required |
---|---|---|---|
destination | String | Recipient address. | Yes |
subject | String | Message subject. | Yes |
text | String | Message body. If you want to use HTML markup, leave this parameter empty ( prompt = ) and fill out the html parameter value instead. | Yes |
files | Array of objects | Attached files. Use the following format for the value:
| No |
html | String | Message body with HTML markup. If you don’t intend to use HTML markup, omit this parameter and use text only. | No |
htmlEnabled | Boolean | If 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 |
okState | String | The state the dialog will switch to if the tag script finishes without errors. | No |
errorState | String | The 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.