使用php发送邮件时,如何摆脱服务器名称

Whenever i use php to send a mail the receiver gets something like this "From: Website plc info@website.com via mirage.arandomserver.com "

How can i get rid of the server name totally?

Here's my current script"

$to="$Email";
$subject="Message received";
$headers= 'From: Website plc <info@website.com>' . "
" .
'Reply-To: $Email' . "
" .
'X-Mailer: PHP/' . phpversion();

$contact_message="
Dear $FirstName $Surname,

message

Thanks
P&C Group Careers
http://www.career.pandcgroupng.com
 ";

 mail("$to", "$subject", $contact_message, $headers);

Use the "envelope from address" additional parameter.

mail($to, $subject, $contact_message, $headers, '-f info@website.com');

This address will be used internally by the mail system for routing purposes. Note this also bypasses some problems with mail filter software detecting "bad" from addresses that don't match the actual originating server.

EDIT - I have absolutely no experience with this on Windows.

You can't. Your server is involved in the SMTP communications and will always be visible in the raw mail message as a header similar to this:

Received: from example.com (example.com. [100.100.100.100])
        by mx.google.com with ESMTP id t8si14713688dfb.115.2013.03.18.10.01.59;
        Mon, 18 Mar 2013 10:01:59 -0700 (PDT)

Because of this mail clients like GMail will show the "via" part you are seeing.

The "via mirage.arandomserver.com" appears when Gmail was unable to verify the "website.com" is actually sending the email. Gmail checks a lot of factors including reverse DNS, SPF records and/or the HELO from the sending SMTP server to verify the server is allowed to be sending as that domain. Has nothing to do with your actual PHP script.

Take a look at Google's documentation on this: http://support.google.com/mail/answer/1311182

Check your SPF records on the "website.com" domain, and ensure they are correct for the email server you are sending from. You may want to talk to the hosting company, or system administrator to get the correct SPF record you need for your hosting setup.