使用邮件功能时出错?

Here $msg and $subject are the variables getting values from the form. When the submit button is clicked, mail() function is to be called.

But there is a warning displayed:

Warning: mail(): Failed to connect to mailserver at "`" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in D:\wamp\www\abhishek\wp-content\themes\abhishek\career.php on line 18.

Here is my code:

$msg=$_POST['msg'];
$subject=$_POST['subject'];
mail('email@example.com',$subject,$msg);

You would need to setup a mail server locally on your machine.The mail function needs SMTP servers for sending out the mails.So you would need to mention the smtp port and smtp host on the php.ini file.

.Please have a look at a similar question here

This is just an example, change values......

$header = "From: contact@".$_SERVER["SERVER_NAME"]."
";
$header .= "Content-Type: text/html; charset=utf-8
";
$recipient = "abhijain.cse@gmail.com"
$subject = $_POST['subject'];

    $body='<table width="90%" border="0">
    <tr>
    <td><b>Name:</b></td> <td>'.$name.'</td>
    </tr>
    <tr>
    <td><b>Email:</b></td> <td>'.$email.'</td>
    </tr>
    <tr>
    <td><b>Message:</b></td> <td>'.$message.'</td>
    </tr>
    <tr></table>';

    $res=@mail($recipient,$subject,$body,$header);