Ok. Now I'm getting desperate. I'm trying to send a simple email from a form to an address provided by the user. It works fine as long as I'm sending to my email address on the local server, but nothing seems to happen if i send to an outside email address (I've tried hotmail, yahoo, mail.com, and teacher.ca). I don't get any error message, but the email is never recieved. Sending an email from the web-based program from this same server works fine. Someone please help before I throw my computer out the window! I've tried the two solutions at php.net (provided by mindplay and pvlasenko) and still the same result. here's my code:
temp.php
<?php
$from_name = $from;
$from_address = $frmEmail;
$to_name = $to;
$to_address = $to." <".$toEmail.">";
//Contents of an Registration Auto responce email(text format)
$message = "Thanks for registering".$to_Name;
$headers .= "From: Name<$from_address>\n";
$headers .= "Reply-To: <$from_address>\n";
$headers .= "X-Sender: <$from_address>\n";
$headers .= "X-Mailer: PHP4\n"; //mailer
$headers .= "X-Priority: 3\n"; //1 UrgentMessage, 3 Normal
$headers .= "Return-Path: <$from_address>\n";
$ok = mail($to_address,"Registration Confirmation",
wordwrap(stripslashes($message)),$headers);
if (!$ok) { die ("Can't send"); }
?>
<html><head></head><body>
<H3>Message sent</H3>
</body></html>
temp1.php
<html><head><title>Test</title></head><body>
<form name="form" method="post" action="temp.php">
To:<br>
<input type="text" size="30" name="to" value="To Name"><br><br>
To Email:
<select name="toEmail">
<option value="xxx@xxx.ca">Library</option>
<option value="xxx@hotmail.com">Hotmail</option>
<option value="xxx@yahoo.com">Yahoo</option>
</select><br><br>
From:<br>
<input type="text" size="30" name="from" value="From Name"><br><br>
From Email:
<select name="frmEmail">
<option value="xxx@xxx.ca">Library</option>
<option value="xxx@hotmail.com" selected>Hotmail</option>
</select><br><br>
Message:<br>
<input type="text" size="30" name="message"
value="this is the message."><br><br>
<input type="submit" value="submit" name="submit">
</form>
</body></html>
Any help would be so very greatfully appeciated!