Register Now


Lost Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

PHP E-Mailer

PHP E-Mailer

PHP E-Mailer is a library that allows you to send emails from a PHP script. It simplifies the process of configuring PHP mail by providing a set of functions for sending emails. It also supports sending emails via SMTP, and authentication is integrated over SSL and TLS. To use PHPMailer, you will need an SMTP server, which you can set up on a hosted server or configure it yourself. You can also install PHPMailer using Composer, a dependency manager for PHP, or manually. You can use the PHP mail() function or a mail-sending library such as PHPMailer to send emails from your PHP application.

About PHP Mail function

The mail function in PHP is used to send emails from a PHP script. It takes four required arguments: the recipient’s email address, the subject of the email, the message body, and additional headers (such as the sender’s address, CC, and BCC recipients).

PHP E-Mailer

Here is an example of a program in PHP that can be used to send an email using an HTML form:


if (isset($_POST['submit'])) {
  $to = "";
  $subject = $_POST['subject'];
  $message = $_POST['message'];
  $headers = "From:" . "\r\n" .
             "Content-type: text/html; charset=utf-8";
  if (mail($to, $subject, $message, $headers)) {
    echo "Email sent successfully!";
  } else {
    echo "An error occurred. Please try again.";


<form method="post" action="">
  <label for="subject">Subject:</label><br>
  <input type="text" id="subject" name="subject"><br>
  <label for="message">Message:</label><br>
  <textarea id="message" name="message"></textarea><br>
  <input type="submit" name="submit" value="Send">

This PHP program first checks if the form has been submitted using the isset function. If it has been submitted, it retrieves the values of the subject and message fields from the $_POST array and stores them in variables. It then sets the $headers variable to specify that the email should be sent in HTML format and include the sender’s email address.

Next, it uses the mail function to send the email. The mail function takes four arguments: the recipient’s email address, the subject of the email, the message body, and the headers. If the email is sent successfully, the program will output “Email sent successfully!”; otherwise, it will output “An error occurred. Please try again.”

Finally, the program includes an HTML form with subject and message fields and a submit button. When the form is submitted, the PHP program will handle the submission and send the email.

Leave a reply