https://github.com/radyai/send-email
A simple API for sending emails effortlessly. Perfect for notifications or just saying hello via email.
https://github.com/radyai/send-email
express mailersend typescript
Last synced: 6 months ago
JSON representation
A simple API for sending emails effortlessly. Perfect for notifications or just saying hello via email.
- Host: GitHub
- URL: https://github.com/radyai/send-email
- Owner: RadyaI
- Created: 2024-09-04T10:38:40.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2025-02-16T14:39:06.000Z (8 months ago)
- Last Synced: 2025-02-16T15:34:13.336Z (8 months ago)
- Topics: express, mailersend, typescript
- Language: TypeScript
- Homepage: https://sendemail.radya.fun
- Size: 17.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Simple Email Sender API
API sederhana untuk mengirim email menggunakan Node.js, Express, dan Nodemailer.
## Endpoint
### `POST /sendemail`
- **Description**: Mengirim email.
- **Request Body**:
```json
{
"emailTo": "recipient@example.com",
"subject": "Your Subject",
"text": "Your email content",
"pass": "your_secret_password"
}
```
- **emailTo**: Alamat email penerima.
- **subject**: Subjek email.
- **text**: Konten email.
- **pass**: Password rahasia yang harus sama dengan `YOUR_PASS` di file `.env`.- **Response**:
- **Berhasil**: Status 200
```json
{
"message": "Email berhasil dikirim!"
}
```
- **Gagal**: Status 400 atau 500
```json
{
"message": "Gagal mengirim email.",
"error": "Error details"
}
```## Contoh Request Menggunakan Fetch di JavaScript
```javascript
fetch('http://localhost:3000/sendemail', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
emailTo: 'recipient@example.com',
subject: 'Test Email',
text: 'Hello from Simple Email Sender API!',
pass: 'your_secret_password'
})
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
```## Catatan Penting
- **YOUR_PASS**: Kamu perlu menambahkan variabel `YOUR_PASS` di file `.env` sebagai password rahasia untuk melindungi endpoint ini. Contoh:
```env
YOUR_PASS=your_secret_password
```## Made By
[Radya](https://radya.fun)