Skip to content

Commit

Permalink
initial commit 🎉
Browse files Browse the repository at this point in the history
  • Loading branch information
snowin-jj committed Jan 4, 2023
0 parents commit de260b6
Show file tree
Hide file tree
Showing 34 changed files with 22,348 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Dependencies
/node_modules

# Production
/build

# Generated files
.docusaurus
.cache-loader

# Misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
41 changes: 41 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Website

This website is built using [Docusaurus 2](https://docusaurus.io/), a modern static website generator.

### Installation

```
$ yarn
```

### Local Development

```
$ yarn start
```

This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.

### Build

```
$ yarn build
```

This command generates static content into the `build` directory and can be served using any static contents hosting service.

### Deployment

Using SSH:

```
$ USE_SSH=true yarn deploy
```

Not using SSH:

```
$ GIT_USER=<Your GitHub username> yarn deploy
```

If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.
3 changes: 3 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
};
40 changes: 40 additions & 0 deletions docs/Demo/Example.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
sidebar_position: 1
---

Let's see an example

**POST** mail

#### Request URL

```
https://devmailer.vercel.app/api/sendmail?apikey=j2hvs2@sh2872092ue12seQ3
```

#### Response

**Status:** 200 Ok

```json
{
"message": "mail has been sent",
"data": {
"accepted": [
"user@test.com"
],
"rejected": [],
"envelopeTime": 169,
"messageTime": 370,
"messageSize": 347,
"response": "250 2.0.0 OK 16728293766 a11-20020a05620a16cb00b006bb29d932e1sm221367966qkn.105 - gsmtp",
"envelope": {
"from": "service.devmailer@gmail.com",
"to": [
"user@test.com"
]
},
"messageId": "<d82a679b-c26f-a5c6-5acf-20f9381301b5d@test.com>"
}
}
```
7 changes: 7 additions & 0 deletions docs/Demo/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"label": "👀 Demo",
"position": 3,
"link": {
"type": "generated-index"
}
}
16 changes: 16 additions & 0 deletions docs/Guide/Authorization.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
sidebar_position: 2
---

#### Public Authorization

Most actions can be performed without requiring authentication from a specific user. For example, fetching, or sending a mail does not require a user to log in.

To authenticate requests in this way, pass your application’s access key via the query parameter:

```
https://devmailer.vercel.app/api/sendmail?apikey=YOUR_API_KEY
```

## <span>⚠️</span> Note:
Keep your API key with you safely. You can access the API only through API key
32 changes: 32 additions & 0 deletions docs/Guide/Mail.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
sidebar_position: 4
---

Send mail by providing the required parameters.

## End point

```
https://devmailer.vercel.app/api
```

## Send mail

Send a mail

```Request
POST /sendmail
```

#### Parameters

| param | Description | Required |
| ------- | ------------------- | -------- |
| from | Sender name | true |
| to | Recevier email ID | true |
| subject | Subject of the mail | true |
| message | Body of the mail | true |


## <span>⚠️</span>Note:
Message can be <i><u>html</u></i>
5 changes: 5 additions & 0 deletions docs/Guide/Rate Limiting.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
sidebar_position: 3
---

You can send 1000 requests per day.
43 changes: 43 additions & 0 deletions docs/Guide/Schema.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
sidebar_position: 1
---

## Location

You can access API at https://devmailer.vercel.app/api

## Summary objects

When retrieving a list of objects, an abbreviated or summary version of that object is returned - i.e., a subset of its attributes. To get a full detailed version of that object, fetch it individually.

## HTTP Verbs

The DevMailer API uses HTTP verbs appropriate to each action.

| Verbs | Description |
| ------ | -------------------- |
| GET | Retrieving resources |
| POST | Creating resources |
| PUT | Updating resources |
| DELETE | Deleting resources |

## Error

If an error occurs, whether on the server or client side, the error message(s) will be returned in as object. For example:

> Status Code: 400
```JSON
{
"message": "from, to, subject, body - these fields are required!",
}
```

| Common Status Codes | Description |
| ------------------- | ----------------------------------------------------------------------- |
| 200 - OK | Everything worked as expected |
| 400 - Bad Request | The request was unacceptable, often due to missing a required parameter |
| 401 - Unauthorized | Invalid Access Token |
| 403 - Forbidden | Missing permissions to perform request |
| 404 - Not Found | The requested resource doesn’t exist |
| 500, 503 | Something went wrong on our end |
7 changes: 7 additions & 0 deletions docs/Guide/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"label": "📗 Guide",
"position": 2,
"link": {
"type": "generated-index"
}
}
7 changes: 7 additions & 0 deletions docs/Integration/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"label": "⛏️ Integration",
"position": 4,
"link": {
"type": "generated-index"
}
}
46 changes: 46 additions & 0 deletions docs/Integration/vanilla JS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
sdibar_position: 1
---

**Integrating Dev Mailer with a simple form in vanilla JS.**

```javascript
const emilForm = document.querySelector('#emailForm')
const API_KEY = YOUR_API_KEY
```

## Create a function that handles and makes a POST request to the api

```javascript
async function handleSubmit(e) {
e.preventDefault()

const form = new FormData(e.target);
const formData = Object.fromEntries(form.entries());


const options = {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(formData)
}

const res = await fetch(`https://devmailer.vercel.app/api/sendmail?apikey=${API_KEY}`, options)

const jsonData = await res.json()
console.log(jsonData)
}
```

## Select the form and add an event listener to it

```javascript
emilForm.addEventListener('submit', handleSubmit)
```

**<span>⚠️</span> Note:**
Make sure the input field names match the fields that are required by the API (from, to, subject, body).

> Live Demo: https://replit.com/@SnowinJ/devmailer-example?v=1
Binary file added docs/img/dashboard-api.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/dashboard.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/home.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/signin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 37 additions & 0 deletions docs/intro.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
slug: /
sidebar_position: 1
---

# 🚀 Getting Started

Let's discover about **Dev Mailer in less than 5 minutes**.

## Steps to follow 📖

Let's get started!

### 1. Create a new account
- Go to the <a href="https://devmailer.vercel.app/" target="_blank">DevMailer official site</a>.

- Click on **Get started**

![instruction image](./img/home.png)

### 2. Complete the registration

![instruction image](./img/signin.png)

### 3. You will be redirected to the dashboord

![instruction image](./img/dashboard.png)

### 4. Here you can find your api key

![instruction image](./img/dashboard-api.png)

Store the api key in ``.env`` file safely.

### That's all, You are good to go 🥳 !

> For any help contact: hello.devmailer@gmail.com
Loading

0 comments on commit de260b6

Please sign in to comment.