0

Mail sending in php on live server has still not sent mail.

 if(isset($_POST['submit'])) {   
    /*$to = "rahulravalinfo@gmail.com";

    $subject = "".$_POST['name']." New Inquiry About

    ".$_POST['subject']."";    $message = "Contact No.

    ".$_POST['contact']."  Message ".$_POST['message']." Email

    ".$_POST['message']."";    $header = "From:rahulravalinfo@gmail.com

    \r\n";    $retval = mail ($to,$subject,$message,$header); */


     $to = "rahulravalinfo@gmail.com"; // this is your Email address
    $from = $_POST['name']; // this is the sender's Email address
    $first_name = $_POST['name'];

    $subject = "New Inquiry from". $_POST['name'];
    $message =  "Contact ".$_POST['contact'] . $first_name . " wrote the following:" . "\n\n" . $_POST['message'];

    $headers = "From:" . $from;
    $headers2 = "From:" . $to;    $retval = mail($to,$subject,$message,$headers);
       if( $retval == true )      {
        $i=1;    }    else    {
        $i=2;   } }
amelvin
  • 8,919
  • 4
  • 38
  • 59
Rahul Raval
  • 109
  • 1
  • 2
  • 5

1 Answers1

1

Please ask your server hosting company for the php mail is enable for your selected plan or not. You can check it using php

if ( function_exists( 'mail' ) )
{
    echo 'mail() is available';
}
else
{
    echo 'mail() has been disabled';
}  
Bhavin Solanki
  • 4,740
  • 3
  • 26
  • 46