通过godaddy.com更改发送邮件的表单地址

i am using the code to send mail via php

$to = $_POST['userId'];
                    $subject = "New password received";
                     $body = 'Your new password is '.'"'.$newPass.'"';
                     if (mail($to, $subject, $body)) {
                      mail. Please check your mail!</p>");
                        $succ = 'Password successfully sent to your mail. Please check your mail!';
                      } else {

                       $err = 'Password delivery failed!';
                      }

now mail is going to the user. but from address is coming as they configure in host(godaddy.com). now how to change the form address in host(godaddy),so that i can get desire from address in received mail?

thanks..

If I understand correctly, you want to change the adress this mail is sent from? If yes, check the mail-documentation here: http://php.net/manual/en/function.mail.php . You have to add a 4th parameter in your mail-function. This passes the headers of the mail.

$headers = 'From: webmaster@example.com' . "
" .
    'Reply-To: webmaster@example.com' . "
" .
    'X-Mailer: PHP/' . phpversion();
$subject = "New password received";
$body = 'Your new password is '.'"'.$newPass.'"';
if (mail($_POST['userId'], $subject, $body, $headers)) {
    $succ = 'Password successfully sent to your mail. Please check your mail!';
} else {
    $err = 'Password delivery failed!';
}

add this

$headers = "From: kdaniel@aosepc.com
";

if (mail($to, $subject, $body,$headers)) {