Page 1 of 1

Mail() command just doesn't work for me....

Posted: Mon Nov 22, 2004 10:38 am
by BizNuge
I'm trying to use the mail command using a php enabled server location and it just won't work...

I've tried a lot of different approaches, but the latest one follows:-

Code: Select all

<?php
mail("graham_campbell@blueyonder.co.uk","please send","this is a long shot");
?>
the error i keep on getting from the server is:-

Code: Select all

Warning: mail(): SMTP server response: 554 &lt;graham_campbell@blueyonder.co.uk&gt;: Recipient address rejected: Relay access denied in \\nas16ent\domains\b\biznuge.co.uk\user\htdocs\mailcommand.php on line 2
Can anyone help. Please. I'm losing what little hair i have left now. And please don't redirect me to other forum postings, because i've been through them and they don't seem to have helped any!!! :?

Posted: Mon Nov 22, 2004 11:17 am
by bluenote
Hi,

the following code is working both under Win and UNIX :

Code: Select all

<?php

$message = "This is a test";
$send_mail = "smebody@else.com";

$sender_name = "your_name";
$sender_email = "you@your_name.com";

$header    = "From: "".addslashes($sender_name)."" <".$sender_email.">\r\n";

$header   .= "Reply-To: ".$sender_email."\r\n";
$header   .= "X-Sender: <$sender_email>\r\n";
$header   .= "X-Priority: 1\r\n";
$header   .= "X-Mailer: PHP / ".phpversion()."\r\n";
$header   .= "Return-Path: <$sender_email>\n";
$header   .= "MIME-Version: 1.0\r\n";
$header   .= "Cc: ".$cc_mail."\r\n";

mail($send_mail,"Subject of your mail",$message,$header);

?>
- bluenote

Posted: Mon Nov 22, 2004 11:35 am
by BizNuge
thanks for the code bluenote, but unfortunately I am still getting a message back from the server informing me:-

Code: Select all

Warning: mail(): SMTP server response: 554 <graham_campbell@blueyonder.co.uk>: Recipient address rejected: Relay access denied in \\nas16ent\domains\b\biznuge.co.uk\user\htdocs\forummail.php on line 14
I saved the code as is, as a PHP script and then uploaded it to my server with my own details filled in. then I tried to run the script and got the above error.

I really can't figure out what could be wrong with this, unless my server is not allowing the command, but surely if it is advertised as PHP enabled, mail function should be working, I would think!!!

Posted: Mon Nov 22, 2004 12:58 pm
by rehfeld
talk to your host, looks like they have things configured out of the norm.