> ## Documentation Index
> Fetch the complete documentation index at: https://vuemail.dev/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Send email using AWS SES

> Learn how to send an email using Vuemail and the AWS SES Node.js SDK.

## 1. Install dependencies

Get the [@vuemaildev/vuemail](https://www.npmjs.com/package/@vuemaildev/vuemail) package and the [AWS SES Node.js SDK](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-ses/).

```sh npm theme={null}
npm install @aws-sdk/client-ses @vuemaildev/vuemail
```

```sh yarn theme={null}
yarn add @aws-sdk/client-ses @vuemaildev/vuemail
```

```sh pnpm theme={null}
pnpm add @aws-sdk/client-ses @vuemaildev/vuemail
```

## 2. Create an email using Vue

Start by building your email template in a `.vue` file.

```vue email.vue theme={null}
<script setup lang="ts">
import { Button, Html } from '@vuemaildev/vuemail';

const { url } = defineProps<{ url: string }>();
</script>

<template>
  <Html lang="en">
    <Button :href="url">Click me</Button>
  </Html>
</template>
```

## 3. Convert to HTML and send email

Import the email template you just built, convert into an HTML string, and use the AWS SES SDK to send it.

```ts theme={null}
import type { SendEmailCommandInput } from "@aws-sdk/client-ses";
import { render } from '@vuemaildev/vuemail';
import { SES } from '@aws-sdk/client-ses';
import Email from './email.vue';

const ses = new SES({ region: process.env.AWS_SES_REGION })

const emailHtml = await render(Email, { url: 'https://example.com' });

const params: SendEmailCommandInput = {
  Source: 'you@example.com',
  Destination: {
    ToAddresses: ['user@gmail.com'],
  },
  Message: {
    Body: {
      Html: {
        Charset: 'UTF-8',
        Data: emailHtml,
      },
    },
    Subject: {
      Charset: 'UTF-8',
      Data: 'hello world',
    },
  },
};

await ses.sendEmail(params);
```

## Try it yourself

> **[AWS SES example](https://github.com/psycarlo/vuemail/tree/main/examples/aws-ses)**
>
> See the full source code.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.