Transactional Email API Service built on top of laravel
- Clone the repo
git clone https://github.com/tuxonice/carob-mailer.git carob-mailer
cd carob-mailer
- Install dependencies
composer install --no-dev
- Build frontend
npm install
npm run prod
- Create .env file
cp .env.example .env
- Generate application key
php artisan generate:key
-
Setup database and mail credentials in .env file
-
Setup webserver to point document root to public folder
http://api.[domain]/mailer/send/
{
"from": {
"name": "Acme Inc."
},
"to": {
"name": "Jonh Doe",
"email": "[email protected]"
},
"subject": "Email subject",
"body": {
"text": "Simplicity is the essence of happiness.",
"html": "<i>Simplicity</i> is the essence of <b>happiness.</b>"
}
}
curl --location --request POST 'http://api.carob-mailer.local/mailer/send' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer 12|tgWanTyitSs3GqaaaqnmrLEpxr7wRUZY0VCRfLK' \
--header 'Content-Type: application/json' \
--data-raw '{
"from": {
"name": "Acme Inc."
},
"to": {
"name": "Jonh Doe",
"email": "[email protected]"
},
"subject": "Email subject",
"body": {
"text": "Simplicity is the essence of happiness.",
"html": "<i>Simplicity</i> is the essence of <b>happiness.</b>"
},
"attachments": [
{
"base64Content": "VGhpcyBpcyBhIGJhc2UgNjQgc3RyaW5n",
"originalFileName": "sample.txt"
}
]
}'
Go to http://[domain]
-
Login or create a new account
-
Create new authentication api token to be used on api request