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

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
BizNuge
Forum Newbie
Posts: 3
Joined: Sun Nov 21, 2004 6:46 pm
Location: Newcastle (UK)

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

Post 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!!! :?
User avatar
bluenote
Forum Commoner
Posts: 93
Joined: Sat Mar 01, 2003 4:59 am
Location: Heidelberg, Germany

Post 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
BizNuge
Forum Newbie
Posts: 3
Joined: Sun Nov 21, 2004 6:46 pm
Location: Newcastle (UK)

Post 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!!!
rehfeld
Forum Regular
Posts: 741
Joined: Mon Oct 18, 2004 8:14 pm

Post by rehfeld »

talk to your host, looks like they have things configured out of the norm.
Post Reply