In your settings.json
file, you'll need to add the following configuration object to the actions
property:
"actions": {
"smtp": {
"user": "[email protected]",
"password": "yourpassword",
"smtpServer": "your.smtp.server",
"from": "Altruist 🚀 <[email protected]>" // optional if sent in request
}
}
You can send emails by sending a POST request using JSON or form-data:
POST /api/v1/actions/smtp
curl -X POST -H "Content-Type: application/json" -d '{
"from": "[email protected]",
"to": "[email protected]",
"subject": "the subject",
"text": "text part",
"html": "html part",
"attachments": [{
"path": "/path/or/url",
"filename": "example.txt"
}]
}' "http://localhost:6060/api/v1/actions/smtp"
Attach files uploaded by form-data
curl -X POST -H "Content-Type: multipart/form-data; boundary=----xxxxxxxxxxxxxxxx"
-F "[email protected]"
-F "[email protected]"
-F "subject=example"
-F "text=text part"
-F "html=html part"
-F "[email protected]"
"http://localhost:6060/api/v1/actions/smtp"
The full list of parameters is available here.
name | type | required | description |
---|---|---|---|
from | string |
× | address that will send the email |
to | `string | array` | × |
subject | string |
− | the email's subject |
text | string |
− | text part of the email |
html | string |
− | html part of the email |
media | file |
− | file to upload and attach to the email |
attachments | array |
− | array of attachment objects |