Main Socket features:
- mailgun/send — send e-mail
- mailgun/webhook — webhook for receiving e-mails via Mailgun
Install package in your project:
cd my_project
npm install @syncano/cli --save-dev
npm install @eyedea-sockets/mailgun --save
npx s deploy
Use it:
import Syncano from '@syncano/client'
const s = new Syncano(<instaneName>)
// E-mail params
const params = {
to: 'john.doe@example.com'
from: 'App admin <example@app.com>'
subject: 'My awesome subject'
html: '<h1>Email title</h1><p>Hello</p>'
}
const sendStatus = await s.post('mailgun/send', params)
Parameter | Type | Description | Example |
---|---|---|---|
to | string | Message recipient | john.doe@example.com |
from | string | Message sender | App admin <example@app.com> |
subject | string | Message subject | My awesome subject |
html | string | Message body in HTML | <h1>Email title</h1><p>Hello</p> |
success - Operation Successful
- Code: 200
- Mimetype: application/json
Parameter | Type | Description | Example |
---|---|---|---|
message | string | Success message | Message sent. |
fail - Operation failed
- Code: 400
- Mimetype: application/json
Parameter | Type | Description | Example |
---|---|---|---|
message | string | Invitation failed | Internal error. |
Mailgun E-mail message payload. For more info check section "Parsed Messages Parameters" of Mailgun docs: https://documentation.mailgun.com/en/latest/user_manual.html#receiving-forwarding-and-storing-messages
success - Operation Successful
- Code: 204
- Mimetype: application/json
fail - Operation failed
- Code: 400
- Mimetype: application/json
Parameter | Type | Description | Example |
---|---|---|---|
message | string | Operation failed | Internal error. |