# sendr_scaleway
A [sendr](https://hex.pm/packages/sendr) backend for sending emails via the [Scaleway](https://www.scaleway.com) Transactional Email REST API.
## Installation
```sh
gleam add sendr sendr_scaleway
```
## Usage
```gleam
import gleam/http
import sendr
import sendr/message
import sendr/message/body
import sendr/message/mailbox
import sendr_scaleway
pub fn send() {
let cfg = sendr_scaleway.config("scw-api-key", "fr-par", "proj-123456")
let msg =
message.new()
|> message.set_from(mailbox.new("Alice", "alice@example.com"))
|> message.set_to([mailbox.new("Bob", "bob@example.com")])
|> message.set_subject("Hello from sendr_scaleway")
|> message.set_body(body.new() |> body.set_text("Hello world!"))
let assert Ok(req) = sendr_scaleway.request(msg, cfg)
// Make the HTTP request with your HTTP client of choice:
// let resp = http_client.send(req)
// let result = sendr_scaleway.response(resp)
}
```
## Configuration
`ScalewayConfig` accepts three parameters:
| Parameter | Description |
|--------------|-----------------------------------------------|
| `api_key` | Your Scaleway secret key (X-Auth-Token) |
| `region` | Scaleway region (e.g. `"fr-par"`, `"nl-ams"`) |
| `project_id` | Your Scaleway Project UUID |
## Shortcomings / Restrictions
- Scaleway doesn't support `reply_to`. An `Error` is returned if one is specified.
- Scaleway doesn't support `InlinedAttachment`s. An `Error` is returned if one is specified.
## Development
```sh
gleam test # Run the tests
SCALEWAY_API_KEY=your_token_here \
SCALEWAY_PROJECT_ID=your_project_id gleam test # Run integration tests and unit tests
gleam run -m devutils/glinter -- --stats # Run the code style checks
```