Pear PHP mail sending - need help

Hi guys,

I am trying to send an email through smtp server. It is working[email sending] when I try is inside office network, but not from the office.

here is the code snippet i used:
$host = ‘’;
$port = 25;
$crlf = "
$message = new Mail_mime($crlf);
$emailBody = $message->get();
$extraheaders = array(“From”=>$from, “To”=>$to, “Subject”=>$subject);
$headers = $message->headers($extraheaders);

$smtp = Mail::factory('smtp', array ('host' => $host,'port' => $port, 'auth' => false));
$mail = $smtp->send($to, $headers, $emailBody);

if (PEAR::isError($mail)) {
	return $mail->getMessage();
} else {
	return "OK";

Please help!

Thank you

Because you are using local network smtp server. You need to set the “relay” on your machine. You may understand about relay problem by searching in search engines or look into the below url