Mail Function Problem
| From: | Jason Hawkins | Date: | Thu, 06 Mar 2003 02:07:04 +0000 |
| Subject: | Mail Function Problem | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-18866@lists.php.net to get a copy of this message | ||
Hi, can anyone help??
I am trying to use the mail() function. It works for addresses that are internal on the intranet -
but as soon as I try sending to an external address such as me@hotmail.com I have problems with the
folllowing error message:
SMTP server response: 550 Relaying denied
here is the portion code:
$firstName = $data["FirstName"];
$emailAddress = $data["EmailAddress"];
$mail_to = $emailAddress;
$mail_subject = "RE: NEWS SUBSCRIPTION";
$mail_body = "Dear " .$firstName . "My Message";
$myname = "BGGS WebMaster";
$myemail = "jhawkins@bggs.qld.edu.au";
$contactname = $firstName;
$contactemail = $mail_to;
$message = $mail_body;
$subject = $mail_subject;
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: ".$myname." <".$myemail.">\r\n";
$headers .= "To: ".$contactname." <".$contactemail.">\r\n";
$headers .= "Reply-To: ".$myname." <$myemail>\r\n";
$headers .= "X-Priority: 1\r\n";
$headers .= "X-MSMail-Priority: High\r\n";
$headers .= "X-Mailer: Just My Server";
if(mail($contactemail, $subject, $message, $headers)){
echo "Refusal email has been sent";
}else {
echo "Failed to send the message";
}
Thanks - if someone could help - I'm using WIN2K, PHP4.3
Jason
This email (including attachments) is intended for the addressee(s) named above. No part of it
should be reproduced, adapted or transmitted without the sender's consent. It is confidential,
subject to copyright and may be subject to legal or other privilege. None of these rights, or any
other rights, are waived if you have received this email in error or without permission. If you have
received this email in error, please let the sender know by reply email, delete it from your system,
destroy all copies and do not disclose, use or forward this email. Unless explicitly attributed, the
opinions expressed in this message do not represent the official position or opinions of Brisbane
Girls Grammar School and should not be relied upon. Whilst this email has been scanned by an up to
date virus scanner and all care has been taken, recipients should check this email and any
attachments for the presence of viruses. Brisbane Girls Grammar School disclaims all liability for
loss or damage caused by viruses transmitted by this email.