Send email via API

Allow sending emails via some kind of API.

HTTP API

Simple POST with signed message in JSON format.
This would allow simple integration into existing frontend and backend systems.

HTTP request proposal

POST /api/v1/email HTTP/1.1
Accept: application/json
Authorization: Basic xxxxxxxxxxxxxxx
Content-Encoding: utf8
Content-Length: ...
Content-Type: application/json
Host: ethmail.cc

{"to":"somename@somedomain.com", "message": "Hi this is example email ....", "signature":"SignatureOf-from-to-message-CreatedUsingETHPersonalSign", "payment": "RawTransactionWithETHTransferToETHMailWallet"}

Message sender will be extracted from signature. In the future it will be possible to pass from key indicating identity (eg. ENS name) that should be used as From data in email headers.

Authorization

/api/v1/email endpoint will use basic auth to identify API clients

Payments

The API will require payment for each email sent using /api/v1/email endpoint.

TBD: prices for emails, ETH or DAI/other, …

Free emails

Each client will be able to send X first emails for free in order to test the integration in production environment.

Single payment

Each API call can contain additional payment key containing raw transaction with transfer of ETH/DAI/??? to ETHMail wallet.

Before sending email the API server will execute this transaction and send email only if the transaction goes through.

TBD exact details.

Down sides:

  • Can be slow depending on network state
  • Compromises some part of client privacy (can be used for counting how much emails given client is sending)

Prepaid

Each client can top-up its account with ETH/DAI/??? in order to be able to send email faster and without compromising privacy

Whisper

Message relayed to mail box.
This would allow integration from decentralized applications and wallets.

Contract events

Allow users to specify contract event that should be converted into emails and sent to their mailbox.

Other ???