---
title: "E-Mails mit Mailgun senden"
description: "Wie nutzt man Mailgun zum Senden von E-Mails mit LaunchFast Starter Kits?"
source: "https://www.launchfa.st/de/documentation/emails/mailgun"
---

> **Site index for agents**
> Fetch https://www.launchfa.st/llms.txt to discover every page on this site.
> Every page is also available as Markdown by appending `.md` to its URL.

> Sehen Sie sich den Quellcode [hier](https://github.com/LaunchFast-Boilerplates/launchfa.st-astro/blob/master/src/lib/utils/email.ts) an.

import { Steps, Tabs, TabItem } from '@astrojs/starlight/components'

LaunchFa.st macht es Ihnen mit seiner integrierten Anbindung leichter, E-Mails mit [Mailgun](https://mailgun.com) zu senden.

So richten Sie Mailgun für die Nutzung mit LaunchFast ein:

<Steps>
  1. Erstellen Sie ein [Mailgun](https://mailgun.com)-Konto.
  2. Fügen Sie Ihre Domain(s) hinzu und verifizieren Sie sie, indem Sie die Schritte in ihrem [Domain-Leitfaden](https://help.mailgun.com/hc/en-us/articles/32884702360603-Domain-Verification-Setup-Guide) abschließen.
  3. Holen Sie sich den Mailgun-API-Schlüssel gemäß ihren [API-Schlüssel-Anweisungen](https://help.mailgun.com/hc/en-us/articles/203380100-Where-can-I-find-my-API-keys-and-SMTP-credentials).
  4. Stellen Sie sicher, dass Sie die Umgebungsvariable(n) Ihrer Anwendung gemäß der folgenden Anweisung aktualisieren:
    
      <Tabs>
        <TabItem label="Astro">
            [https://github.com/LaunchFast-Boilerplates/launchfa.st-astro#email](https://github.com/LaunchFast-Boilerplates/launchfa.st-astro#email)
        </TabItem>
        <TabItem label="SvelteKit">
            [https://github.com/LaunchFast-Boilerplates/launchfa.st-sveltekit#email](https://github.com/LaunchFast-Boilerplates/launchfa.st-sveltekit#email)
        </TabItem>
        <TabItem label="Next.js">
            [https://github.com/LaunchFast-Boilerplates/launchfa.st-nextjs#email](https://github.com/LaunchFast-Boilerplates/launchfa.st-nextjs#email)
        </TabItem>
      </Tabs>
</Steps>

Um E-Mails mit Mailgun zu senden, verwenden Sie das `sendEmail`-Hilfsprogramm in Ihrem serverseitigen Code:

<Tabs>

<TabItem label="Astro">

```typescript
// File: src/pages/api/random.ts

import { sendEmail } from '@/lib/utils/email'
import type { APIContext } from 'astro'

export async function GET({ request }: APIContext) {
  // From a server-side API that is being fetched

  // Send an email using Resend
  // Read more on https://resend.com/docs/api-reference/emails/send-email
  await sendEmail({
    text: context.text,
    subject: context.subject,
    from: 'Rishi Raj Jain <emails@rishi.app>',
    to: typeof context.to === 'string' ? [context.to] : context.to,
  }, 'mailgun')
}

export async function POST({ request }: APIContext) {
  // From a server-side API that is being POST-ed to

  // Send an email using Resend
  // Read more on https://resend.com/docs/api-reference/emails/send-email
  await sendEmail({
    text: context.text,
    subject: context.subject,
    from: 'Rishi Raj Jain <emails@rishi.app>',
    to: typeof context.to === 'string' ? [context.to] : context.to,
  }, 'mailgun')
}
```

</TabItem>

</Tabs>
