Skip to content

Commit

Permalink
feat(docs): update docs (#1020)
Browse files Browse the repository at this point in the history
feat(docs): update docs

Updates the Wing docs. See details in [workflow run].

[Workflow Run]: https://github.com/winglang/docsite/actions/runs/10927224919

------

*Automatically created via the "update-docs" workflow*
  • Loading branch information
monadabot authored Sep 18, 2024
1 parent b5d484f commit 08c49a7
Show file tree
Hide file tree
Showing 2 changed files with 127 additions and 0 deletions.
1 change: 1 addition & 0 deletions versioned_docs/version-latest/04-winglibs/04-toc.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ keywords: [winglib, Wing library]
| [Amazon Cognito](/docs/winglibs/winglibs/cognito) | [@winglibs/cognito](/docs/winglibs/winglibs/cognito) | v0.0.14 | A wing library to work with Amazon Cognito | [sim](/docs/platforms/sim), [tf-aws](/docs/platforms/AWS/tf-aws) |
| [Containers](/docs/winglibs/winglibs/containers) | [@winglibs/containers](/docs/winglibs/winglibs/containers) | v0.1.6 | Deploy containers with Wing | [sim](/docs/platforms/sim), [tf-aws](/docs/platforms/AWS/tf-aws) |
| [Amazon DynamoDB](/docs/winglibs/winglibs/dynamodb) | [@winglibs/dynamodb](/docs/winglibs/winglibs/dynamodb) | v0.2.4 | A Wing library for Amazon DynamoDB | [sim](/docs/platforms/sim), [tf-aws](/docs/platforms/AWS/tf-aws) |
| [Email](/docs/winglibs/winglibs/email) | [@winglibs/email](/docs/winglibs/winglibs/email) | v0.0.1 | A wing library for sending emails | [sim](/docs/platforms/sim), [tf-aws](/docs/platforms/AWS/tf-aws) |
| [Amazon EventBridge](/docs/winglibs/winglibs/eventbridge) | [@winglibs/eventbridge](/docs/winglibs/winglibs/eventbridge) | v0.1.8 | A Wing library for working with Amazon EventBridge | [sim](/docs/platforms/sim), [tf-aws](/docs/platforms/AWS/tf-aws), [awscdk](/docs/platforms/AWS/awscdk) |
| [FIFO Queue](/docs/winglibs/winglibs/fifoqueue) | [@winglibs/fifoqueue](/docs/winglibs/winglibs/fifoqueue) | v0.0.12 | A wing library to work with FIFO (first-in first-out) Queues | [sim](/docs/platforms/sim), [tf-aws](/docs/platforms/AWS/tf-aws) |
| [GitHub](/docs/winglibs/winglibs/github) | [@winglibs/github](/docs/winglibs/winglibs/github) | v0.0.16 | A wing library to work with GitHub Probot | [*](/docs/platforms/platforms) |
Expand Down
126 changes: 126 additions & 0 deletions versioned_docs/version-latest/04-winglibs/05-winglibs/email.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
---
title: Email
id: email
sidebar_label: Email
description: A wing library for sending emails
keywords: [winglib, Wing library]
---
# email

## Prerequisites

* [winglang](https://winglang.io).

For AWS, you need to have an AWS account and the AWS CLI installed. You'll also need to have [Terraform](https://developer.hashicorp.com/terraform/install) or [OpenTofu](https://opentofu.org/docs/intro/install/) installed to deploy the application.

## Installation

```sh
npm i @winglibs/email
```

## Usage

```js
bring email;

let email = new email.Email(sender: "[email protected]");

new cloud.Function(inflight () => {
email.send(
to: ["[email protected]"],
subject: "My subject",
text: "My content",
html: "<h1>My content</h1>", // optional
);
});
```

### Simulator

When using `email.Email` in the local simulator, emails are mocked and are emitted to the logs.
A table showing all emails that have been sent can be viewed in the email resource's interaction panel.

### AWS

When compiled to AWS platforms, the email resource uses [Amazon SES](https://aws.amazon.com/ses/).
For testing, we recommend using your own email address for `sender` since sender email addresses must be verified.
When the application is deployed, an email will be sent to verify the configured `sender` address.

By default, new AWS accounts are in the sandbox mode. This means emails can only be sent to verified addresses. It also limits the number of emails that can be sent. To send emails to other addresses, you need to request production access [here](https://docs.aws.amazon.com/ses/latest/dg/request-production-access.html).

## License

This library is licensed under the [MIT License](./LICENSE).

---
## API Reference

### Table of Contents

- **Classes**
- <a href="#@winglibs/email.Email">Email</a>
- **Interfaces**
- <a href="#@winglibs/email.IEmail">IEmail</a>
- **Structs**
- <a href="#@winglibs/email.EmailProps">EmailProps</a>
- <a href="#@winglibs/email.SendEmailOptions">SendEmailOptions</a>

### Email (preflight class) <a class="wing-docs-anchor" id="@winglibs/email.Email"></a>

*No description*

#### Constructor

```
new(props: EmailProps): Email
```

#### Properties

*No properties*

#### Methods

| **Signature** | **Description** |
| --- | --- |
| <code>inflight send(options: SendEmailOptions): void</code> | *No description* |

### IEmail (interface) <a class="wing-docs-anchor" id="@winglibs/email.IEmail"></a>

*No description*

#### Properties

*No properties*

#### Methods

| **Signature** | **Description** |
| --- | --- |
| <code>inflight send(options: SendEmailOptions): void</code> | Sends a simple email. |

### EmailProps (struct) <a class="wing-docs-anchor" id="@winglibs/email.EmailProps"></a>

*No description*

#### Properties

| **Name** | **Type** | **Description** |
| --- | --- | --- |
| <code>sender</code> | <code>str</code> | The email address for the sender of all emails. |

### SendEmailOptions (struct) <a class="wing-docs-anchor" id="@winglibs/email.SendEmailOptions"></a>

*No description*

#### Properties

| **Name** | **Type** | **Description** |
| --- | --- | --- |
| <code>html</code> | <code>str?</code> | The body of the email, in HTML. @default - The text body will be used as the HTML body. |
| <code>subject</code> | <code>str</code> | The subject of the email. |
| <code>text</code> | <code>str</code> | The body of the email, in plain text. |
| <code>to</code> | <code>Array<str></code> | The email addresses to send the email to. |


0 comments on commit 08c49a7

Please sign in to comment.