在实时服务器上用php发送邮件仍然没有发送邮件。
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; } }
答案 0 :(得分:1)
请询问您的服务器托管公司是否为您选择的计划启用了php邮件。 你可以用php
来检查它if ( function_exists( 'mail' ) )
{
echo 'mail() is available';
}
else
{
echo 'mail() has been disabled';
}