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:
include(“Mail.php”);
include(‘Mail/mime.php’);
$host = ‘’;
$port = 25;
$crlf = "
";
$message = new Mail_mime($crlf);
$message->setTXTBody($bodytxt);
$message->setHTMLBody($bodyhtml);
$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

http://www.linuxforums.org/forum/servers/41547-best-smtp-relay-solution.html