Re: PHP Mail() and Exchange Server



kippling wrote:
I have created a php script to collect inputs from a html form. I host
this on the back of my site and have previously had it addressed to
send the email to an email address that i'm hosted with. This works
fine but when i change the email address to an one which is using
exchange server i get the following error:

Warning: mail(): SMTP server response: 554 <app1@xxxxxxxxxxxxx>:
Recipient address rejected: Relay access denied in
e:\domains\h\hds.co.uk\user\htdocs\test\testmail1.php on line 46

Warning: Cannot modify header information - headers already sent by
(output started at
e:\domains\h\hds.co.uk\user\htdocs\test\testmail1.php:46) in
e:\domains\h\hds.co.uk\user\htdocs\test\testmail1.php on line 47

the php code is:
<?

$mailto = 'app1@xxxxxxxxxxxxxxxxxxxxx';

$subject = $_POST['sub'] ;

//$formurl	= "http://www.example.com/feedback.html"; ;
//$errorurl	= "http://www.example.com/error.html"; ;
//$thankyouurl	= "http://www.example.com/thankyou.html"; ;

$formurl = "http://www.hds.co.uk/hds/formtest.htm"; ;
$errorurl = "http://www.hds.co.uk/hds/error.htm"; ;
$thankyouurl = "http://www.hds.co.uk/hds/sent.htm"; ;
$fullname = $_POST['fullname'] ;
$address = $_POST['address'];
$email = $_POST['email'];
$http_referrer = getenv( "HTTP_REFERER" );

if (!isset($_POST['email'])) {
	header( "Location: $formurl" );
	exit ;
}
if (empty($fullname) || empty($address)) {
   header( "Location: $errorurl" );
   exit ;
}
if (get_magic_quotes_gpc()) {
	$comments = stripslashes( $comments );
}

$messageproper =
	"$http_referrer\n" .
"
full Name: $fullname
Address: $address
";


mail($mailto, $subject, $messageproper, "From: \"$fullname\" <$email>\n Reply-To: \"$fullname\" <$email>\n X-Mailer: app1 ver 1.0\n MIME-Version: 1.0\n Content-type: text/plain; charset=iso-8859-1\n X-Priority: 3\n X-MSMail-Priority: Normal\n" ); header( "Location: $thankyouurl" ); exit ;

?>



why can i not send my message to an exchange server am I missing
something. Please Help.

Kippling

The exchange server is apparantly set to DENY email relays (like it should). In other words it does not accept mails from others that its own domains, to prevent people using it for mass spam relay.

Sh
.



Relevant Pages

  • Broken pipes and single quotes
    ... Once in a while my ever smooth running mail relay (sending to and from our ... internal Exchange server) starts creating a queue and refuses more or less to ... That email shows a large number of recipients on the To: header (approx. ... and the thingy that refuses this message to be relayed are the single quotes ...
    (comp.mail.sendmail)
  • Re: Where is this message coming from?
    ... MoSaHVG@xxxxxxxxx and the Internet header had the message ID coming from ... exchange server. ... relay, a spoof, or is it actually coming from within our organization? ...
    (microsoft.public.exchange.admin)
  • Re: Header call and exit()
    ... If making a header(location:) call, is it good practice to place an exit() statement after it, or will the header call take control of the script? ... Obviously the request is within the same ...
    (comp.lang.php)
  • Re: Unable to relay to a.asn.au
    ... Okay, I found three policies, so I've added the domains to another policy, ... mail gets refusal to relay. ... it should accept mail for several internet domains? ... Our exchange server answers as exchange.c.net, ...
    (microsoft.public.exchange.admin)
  • RE: SPAM via SMTP? RPC?
    ... anyone who can connect to either a WiFi access point or plug ... in to a network jack can relay (DHCP will assign them an IP address that will ... >> Have you considered the possibility of an open WiFi access point? ... >>> somebody has sent out a ton of spam using our Exchange server. ...
    (microsoft.public.exchange.admin)