All frameworks
PHPPHP

Use NBForms with PHP

PHP makes it easy to process form data, but handling email delivery, spam filtering, and storage is work you don't need to do. NBForms replaces your PHP mailer with a single HTTP request — just proxy the POST data and you're done.

Official PHP docs
PHP
<?php
$success = false;
$message = '';
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    $opts = stream_context_create(['http' => [
        'method'  => 'POST',
        'header'  => 'Content-Type: application/x-www-form-urlencoded',
        'content' => http_build_query($_POST),
    ]]);
    $body    = @file_get_contents('https://api.nbforms.com', false, $opts);
    $data    = $body ? json_decode($body, true) : [];
    $success = !empty($data['success']);
    $message = $data['message'] ?? '';
}
?>
<?php if ($success): ?>
  <p><?= htmlspecialchars($message) ?></p>
<?php else: ?>
  <form method="POST">
    <input type="hidden" name="_token" value="YOUR_TOKEN" />
    <label>Name</label>
    <input type="text" name="name" required />
    <label>Email</label>
    <input type="email" name="email" required />
    <label>Message</label>
    <textarea name="message" required></textarea>
    <button type="submit">Send</button>
  </form>
<?php endif; ?>

Why NBForms?

  • Drop-in replacement for PHPMailer or mail()
  • Works on any PHP 7.4+ host
  • No Composer dependencies or additional packages needed
  • Handles email delivery, spam filtering, and storage

Add to your PHP app in minutes

Free tier included. No credit card. No backend setup — just copy the snippet above and go.

Get started free