Application server of sh8.email which is a entirely rewritten version with Node.js
Run npm test
.
- Create a mail
- Show mails list
- GET /api/recipient/:recipient/mails
- Response
- Success: List of mails represented as JSON
[mail1, mail2, mail3, ...]
- There is
isSecret
boolean field - Respond empty array when there is no mail which is matched query
- There is
- Fail
- Respond 404 Not Found if the 'recipient' params is missing
- Success: List of mails represented as JSON
- Show a non-secret mail
- GET /api/recipient/:recipient/mails/:id
- Response
- Success: A mail represented as JSON
- Fail
- Respond 404 Not Found if the 'recipient' params is missing or the requested mail is not present
- Show a secret mail
- GET /api/recipient/:recipient/mails/:id
- Header required
- Sh8-Secret-Code: the secretCode
- Response
- Success: A mail represented as JSON
- Fail
- Respond 404 Not Found if the 'recipient' params is missing or the requested mail is not present
- Respond 403 Forbidden if the secretCode is invalid
We use mail model which is based on mail model of nodemailer/mailparser.
But there is a difference representing address
object likes from
, to
, cc
and bcc
.
We removed html
, text
property of address
object and spreaded value
property. Therefore the address
object is shown as below example.
// Representation of `to` property in address object
[
{
address: '[email protected]',
name: 'Andris Reinman'
},
{
address: '[email protected]',
name: ''
}
]
Also, there are some additional properties.
- isSecret: Boolean.
true
if the mail is a secret mail, otherwisefalse
.