Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/dylanon/mailer

Handle email contact forms - serverless!
https://github.com/dylanon/mailer

Last synced: about 1 month ago
JSON representation

Handle email contact forms - serverless!

Awesome Lists containing this project

README

        

# Mailer

Email form serverless function built for [Zeit Now](https://github.com/zeit/now) and Dreamhost's email service.

## Setup

### Add secrets

The Dreamhost-hosted email address that messages will be sent from (your "mailer" address):

```bash
npx now secrets add namespace-mail-user [email protected]
```

The password for that email address:

```bash
npx now secrets add namespace-mail-pass yourpasswordhere
```

The email address that messages will be sent to:

```bash
npx now secrets add namespace-mail-send-to [email protected]
```

### Deploy to Now

```bash
yarn deploy:prod
```

## Usage

### POST /api/contact

```javascript
fetch('https://yourdomainhere.com/api/contact', {
method: 'POST',
body: JSON.stringify({
message: 'Just wanted to say hi!',
senderEmail: '[email protected]',
senderName: 'Some Sender',
subject: 'Hello world'
})
});
```