`recipient` can be a single address (`mail@example.com`) or a list of addresses, concatenated by a comma (`mail@example.com, mail2@example.com`).
-Since there is a separate rule action instance for each `smtp` thing, this needs to be retrieved through `getActions(scope, thingUID)`.
+Since there is a separate rule action instance for each `smtp` thing, this needs to be retrieved through `getActions(scope, thingUID)` (DSL) or `actions.get(scope, thingUID)` (Javascript).
The first parameter always has to be `mail` and the second is the full Thing UID of the SMTP server that should be used.
Once this action instance is retrieved, you can invoke the action method on it.
Examples:
+:::: tabs
+
+::: tab DSL
+
```java
val mailActions = getActions("mail","mail:smtp:samplesmtp")
val success = mailActions.sendMail("mail@example.com", "Test subject", "This is the mail content.")
val mailActions = getActions("mail","mail:smtp:sampleserver")
mailActions.sendHtmlMailWithAttachments("mail@example.com", "Test subject", "<h1>Header</h1>This is the mail content.", attachmentUrlList)
```
+:::
+
+::: tab JavaScript
+
+```javascript
+val mailActions = actions.get("mail","mail:smtp:samplesmtp")
+val success = mailActions.sendMail("mail@example.com", "Test subject", "This is the mail content.")
+success = mailActions.sendMail("mail1@example.com, mail2@example.com", "Test subject", "This is the mail content sent to multiple recipients.")
+
+```
+
+```javascript
+import java.util.List
+
+val List<String> attachmentUrlList = newArrayList(
+ "http://some.web/site/snap.jpg¶m=value",
+ "file:///tmp/201601011031.jpg")
+val mailActions = actions.get("mail","mail:smtp:sampleserver")
+mailActions.sendHtmlMailWithAttachments("mail@example.com", "Test subject", "<h1>Header</h1>This is the mail content.", attachmentUrlList)
+```
+
+:::
+::::
## Mail Headers
The binding allows one to add custom e-mail headers to messages that it sends.
Headers can be added inside a rule by calling the `mailActions.addHeader()` method before calling the respective `mailActions.sendMail()` method.
See the example below.
+:::: tabs
+
+::: tab DSL
+
+
```java
rule "Send Mail with a 'Reference' header; for threaded view in e-mail client"
when
mailActions.sendMail("mail@example.com", "Test subject", "Test message text")
end
```
+:::
+
+::: tab JavaScript
+
+```javascript
+val mailActions = actions.get("mail","mail:smtp:sampleserver")
+mailActions.addHeader("Reference", "<unique-thread-identifier>")
+mailActions.sendMail("mail@example.com", "Test subject", "Test message text")
+```
+
+:::
+::::
Note: in the case of the "Reference" header, the `<unique-thread-identifier>` has to be an ASCII string enclosed in angle brackets.