Jump to content

mail function not working


raman

Recommended Posts

Here is my very simple script for a feedback form, though everything seems fine in the script, it shows the message,--your message has been sent .... after taking lot of time, around 3-4 minutes, however the email never reaches. ( I have two mail functions, one to send the mail to the user and another to my email.)

 

Do I need to make any special changes in php.ini for the emails to reach ?

 

 




<?php
$emai = $_REQUEST['email'] ;
$messa = $_REQUEST['message'] ;

if (strlen($messa)<=401){

  mail( "[email protected]", "Feedback Form Results", $message, "From: $emai" );
mail( "$emai", "Feedback form copy", $message, "From: The Team" );

  //header( "Location: http://192.168.1.16/iccg/thankyou.html" );
  echo "<font color='#d11010' size='4'>Your message has been sent to The team.<br>A copy has been delivered to $emai for you reference.</font>";
}else{
  echo "<font color='#d11010' size='4'>Please enable javascript on your browser,then send the message !!</font>";
}

?>

Link to comment
https://forums.phpfreaks.com/topic/161154-mail-function-not-working/
Share on other sites

Instead of using mail() on its own you can use something like this:

if (mail($emai, "Feedback form copy",$message,"From: The Team <[email protected]>\r\n")) {
  echo 'Mail sent';
} else {
  echo 'Mail not sent';
}

The only other change I made was to add the from email address and added a new line and live feed on the end.

 

The other option is to use PHPMailer - a third party script you can download and use for free (Google will be your friend)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.