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!.

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.

Read Also:  PHP CodeIgniter 3 Generate Random record from mysql

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 Array Tutorial With Examples - filter array

<?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.

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.