How to get mail directly whenever fill a form
You're looking to receive an email notification whenever a form is filled out. Here are a few ways to achieve this:
Method 1: Using a Form Builder with Email Notification
- Choose a form builder like Google Forms, Microsoft Forms, or JotForm.
- Create a form with the fields you need.
- Set up an email notification in the form builder's settings. This will send an email to a specified address whenever someone submits the form.
Method 2: Using a Webhook
- Choose a form builder like Wufoo, Formstack, or 123ContactForm.
- Create a form with the fields you need.
- Set up a webhook in the form builder's settings. A webhook is a URL that receives data whenever someone submits the form.
- Configure the webhook to send an email to a specified address using a service like Zapier or IFTTT.
Method 3: Using a Programming Language
- Choose a programming language like PHP, Python, or JavaScript.
- Create a form using HTML and JavaScript.
- Use the programming language to send an email using a library like PHPMailer (for PHP) or smtplib (for Python).
- Set up a server-side script to receive the form data and send an email whenever someone submits the form.
Example Code (PHP)
<?php
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
// Send email using PHPMailer
require 'PHPMailer/PHPMailer.php';
require 'PHPMailer/SMTP.php';
require 'PHPMailer/Exception.php';
$mail = new PHPMailer\PHPMailer\PHPMailer();
$mail->isSMTP();
$mail->Host = 'your-smtp-host';
$mail->Port = 587;
$mail->SMTPAuth = true;
$mail->Username = 'your-smtp-username';
$mail->Password = 'your-smtp-password';
$mail->setFrom('your-email-address');
$mail->addAddress('recipient-email-address');
$mail->Subject = 'New Form Submission';
$mail->Body = "Name: $name\nEmail: $email\nMessage: $message";
$mail->send();
echo 'Email sent!';
} else {
echo 'Invalid request';
}
?>
Method 4: Using a Third-Party Service
- Choose a third-party service like Formidable Forms or Gravity Forms.
- Create a form with the fields you need.
- Set up an email notification in the service's settings. This will send an email to a specified address whenever someone submits the form.
These are just a few ways to receive an email notification whenever a form is filled out. The method you choose will depend on your specific needs and technical expertise.