Demo na żywo
Prawdziwy formularz. Prawdziwy e-mail. Wypróbuj.
Wybierz framework. Po lewej jest kompletny komponent, po prawej ten sam komponent działający na produkcyjnym API Frontmail. Wyślij wiadomość i zobacz, jak przechodzi.
Działający komponent · React
To demo ma ograniczoną liczbę wysyłek. Wiadomości trafiają do skrzynki zespołu Frontmail, nigdy na adres, który wpiszesz.
Kod źródłowy: InquiryForm.tsx
import { FrontmailForm, FrontmailProvider } from '@frontmail/react';
import type { FrontmailError, SendResult } from '@frontmail/react';
const options = {
publicKey: 'pk_••••••••',
};
interface Props {
onSuccess?: (result: SendResult) => void;
onError?: (error: FrontmailError) => void;
}
export function InquiryForm({ onSuccess, onError }: Props) {
return (
<FrontmailProvider options={options}>
<FrontmailForm
serviceId="YOUR_SERVICE_ID"
templateId="tpl_01m3hk61yth7gefvf2s5h7gefv"
turnstileSiteKey="YOUR_TURNSTILE_SITE_KEY"
onSuccess={onSuccess}
onError={onError}
>
{({ status }) => (
<>
<label>
Imię i nazwisko
<input name="name" autoComplete="name" required maxLength={200} />
</label>
<label>
E-mail
<input name="email" type="email" autoComplete="email" required />
</label>
<label>
Wiadomość
<textarea name="message" rows={4} required minLength={2} maxLength={5000} />
</label>
<button type="submit" disabled={status === 'sending'}>
{status === 'sending' ? 'Wysyłanie…' : 'Wyślij wiadomość'}
</button>
</>
)}
</FrontmailForm>
</FrontmailProvider>
);
}Klucz publiczny jest tu zamaskowany. Użyj własnego z panelu – w kodzie frontendu jest bezpieczny, bo chronią go dozwolone domeny i CAPTCHA.
Działający komponent · Svelte
To demo ma ograniczoną liczbę wysyłek. Wiadomości trafiają do skrzynki zespołu Frontmail, nigdy na adres, który wpiszesz.
Kod źródłowy: InquiryForm.svelte
<script lang="ts">
import { FrontmailForm, createFrontmail } from '@frontmail/svelte';
import type { FrontmailError, SendResult } from '@frontmail/svelte';
interface Props {
onSuccess?: (result: SendResult) => void;
onError?: (error: FrontmailError) => void;
}
let { onSuccess, onError }: Props = $props();
const frontmail = createFrontmail({
publicKey: 'pk_••••••••',
});
</script>
<FrontmailForm
{frontmail}
serviceId="YOUR_SERVICE_ID"
templateId="tpl_01m3hk61yth7gefvf2s5h7gefv"
turnstileSiteKey="YOUR_TURNSTILE_SITE_KEY"
{onSuccess}
{onError}
>
{#snippet children({ status })}
<label>
Imię i nazwisko
<input name="name" autocomplete="name" required maxlength="200" />
</label>
<label>
E-mail
<input name="email" type="email" autocomplete="email" required />
</label>
<label>
Wiadomość
<textarea name="message" rows="4" required minlength="2" maxlength="5000"></textarea>
</label>
<button type="submit" disabled={status === 'sending'}>
{status === 'sending' ? 'Wysyłanie…' : 'Wyślij wiadomość'}
</button>
{/snippet}
</FrontmailForm>Klucz publiczny jest tu zamaskowany. Użyj własnego z panelu – w kodzie frontendu jest bezpieczny, bo chronią go dozwolone domeny i CAPTCHA.
Działający komponent · Vue
To demo ma ograniczoną liczbę wysyłek. Wiadomości trafiają do skrzynki zespołu Frontmail, nigdy na adres, który wpiszesz.
Kod źródłowy: InquiryForm.vue
<script setup lang="ts">
import { provide } from 'vue';
import { FrontmailForm, FrontmailKey, createClient } from '@frontmail/vue';
import type { FrontmailError, SendResult } from '@frontmail/vue';
const emit = defineEmits<{ success: [result: SendResult]; error: [error: FrontmailError] }>();
// In an app you would call app.use(Frontmail, { publicKey }) once in main.ts instead.
provide(
FrontmailKey,
createClient({
publicKey: 'pk_••••••••',
}),
);
</script>
<template>
<FrontmailForm
service-id="YOUR_SERVICE_ID"
template-id="tpl_01m3hk61yth7gefvf2s5h7gefv"
turnstile-site-key="YOUR_TURNSTILE_SITE_KEY"
@success="(result) => emit('success', result)"
@error="(error) => emit('error', error)"
>
<template #default="{ status }">
<label>
Imię i nazwisko
<input name="name" autocomplete="name" required maxlength="200" />
</label>
<label>
E-mail
<input name="email" type="email" autocomplete="email" required />
</label>
<label>
Wiadomość
<textarea name="message" rows="4" required minlength="2" maxlength="5000"></textarea>
</label>
<button type="submit" :disabled="status === 'sending'">
{{ status === 'sending' ? 'Wysyłanie…' : 'Wyślij wiadomość' }}
</button>
</template>
</FrontmailForm>
</template>Klucz publiczny jest tu zamaskowany. Użyj własnego z panelu – w kodzie frontendu jest bezpieczny, bo chronią go dozwolone domeny i CAPTCHA.
Chcesz to mieć na swojej stronie?
Załóż darmowe konto, podłącz usługę e-mail, której już używasz, i wybierz szablon z galerii. Cała konfiguracja zajmuje około piętnastu minut.