Send Simple Mail Function using PHP

Send Simple Mail Function using PHP

In this Post We Will Explain About is Send Simple Mail Function using PHP With Example and Demo.Welcome on Pakainfo.com – Examples, The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to PHP check if mail() function is enabled on your serverExample

In this post we will show you Best way to implement PHP mail() function simple test script, hear for Test and send mail using PHPwith Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

Read Also:  Paytm Payment Gateway Integration in PHP step By step

PHP mail() function simple test script

Prerequisites

First of all check your Mail available or disabled Your Domain Check.and then The simple php mail() function all the allows you to simple send emails using PHP directly from a php script.

if ( function_exists( 'mail' ) )
{
    echo 'Good Work, Your mail() is available';
}
else
{
    echo 'Sorry !! , Your mail() has been disabled';

}

Access to your simple hosting via SSH or FTP

Create the simple-mail.php script with the following:

<?php 
ini_set( 'display_errors', 1 );
error_reporting( E_ALL );
$from = "[email protected]";
$to = "[email protected]";
$live_subject = "Simple PHP Mail Test Live script";
$your_live_message = "This is a My First test Email to check the supported PHP Mail functionality or not.";
$live_headers = "From:" . $from;
try {
  $data = mail($to,$live_subject,$your_live_message,$live_headers);
  var_dump($data);
}
catch(Exception $e) {
  echo 'Message: ' .$e->getMessage();
}
?>

Test PHP mail functionality

Before we can send simple PHP mail, it is very important to test the send PHP mail’s functionality. we can use the simple following source code saved into a PHP file with a .php extension:

Read Also:  php - SMTP Send mail using PHPMailer PHP Contact Form

<?php
 $headers = 'From: [email protected]';
 mail('[email protected]', 'Test email using PHP', 'Wel come - Pakainfo.com This is a test First email message', $headers, '[email protected]'); ?>

Important: We recommend using an simple PHP SMTP relay that requires must be authentication. Sending mail through all the users unauthenticated SMTP servers so (most of the including as well as the localhost relay on any Cloud Sites) can simple result in or any delays or mail undelivered email because reason of stringent or any anti-spam filters.

Read Also:  Mail send with attachment in php demo

Example

I hope you have Got What is Test PHP mail functionality And how it works.I would Like to have FeadBack From My Blog(Pakainfo.com) readers.Your Valuable FeadBack,Any Question,or any Comments abaout This Article(Pakainfo.com) Are Most Always Welcome.


Related FAQ

Here are some more FAQ related to this Article:

  1. Read Also:  Nodejs Login and Registration with PHP MySQL and SQLite Example
  2. Read Also:  AngularJs Clone Array
  3. Read Also:  PHP Send Email using SMTP Authentication
  4. Read Also:  How To Create Contact Form With PHPMailer To Send Mails
  5. Read Also:  Data Export to Excel with PHP and MySQL
  6. Read Also:  How to use whereHas with orWhereHas in Laravel?
  7. Read Also:  Vue js Fancybox Popup Simple Example
  8. Read Also:  php foreach multidimensional array Example
  9. Read Also:  React JSX Basics Step By Step
  10. Read Also:  Create Contact Form And Send Email using PHP
CLOSEX