Jump to content


Photo

Error in sending an email with the mail() command


  • Please log in to reply
3 replies to this topic

#1 Xurion

Xurion
  • Members
  • PipPipPip
  • Advanced Member
  • 259 posts

Posted 27 October 2006 - 08:42 AM

Whilst testing a script i supplied my own email address in the code so the mail command I was using would show me it was working when I received an email. Once the code was complete, the address was changed to another and for some reason the following error appears:

Warning: mail(): SMTP server response: 554 <client@domain.com>: Recipient address rejected: Relay access denied in bla bla.. on line 14

Seems to work if I change it back to my address.

Any suggestions would be great.

#2 lonewolf277

lonewolf277
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 27 October 2006 - 09:30 AM

Hmmm... interesting problem. :)

I'm assuming you can send mail to the address from something like GMail or Thunderbird? What headers are you using? Are you hard-coding the e-mail address in, or are you getting it from somewhere else like a database?

#3 vamsee

vamsee
  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 27 October 2006 - 09:41 AM

Dude I had the same problem before. You have to contact your hosting compnay regarding this error. It has nothing to do with your code. Tell them you face this problem and then they will rectify it.

#4 Xurion

Xurion
  • Members
  • PipPipPip
  • Advanced Member
  • 259 posts

Posted 27 October 2006 - 10:16 AM

Hmmm... interesting problem. :)

I'm assuming you can send mail to the address from something like GMail or Thunderbird? What headers are you using? Are you hard-coding the e-mail address in, or are you getting it from somewhere else like a database?

The test address i used (my personal one) was xurion@hotmail.com, and the client's email was another hotmail.com address (if I have to give this also I will)

here is my code:
<?php
ini_set("sendmail_from", "xurion@hotmail.com");
$mailfrom = "xurion@hotmail.com";
$mailto = "xurion@hotmail.com";

$mailtext .= 'This is the body text';
$headers = 'From: '.$mailfrom.'
Reply-to: '.$mailfrom.'
Return-path: '.$mailfrom.'
Content-type: text/html

';
mail($mailto, 'Notification', $mailtext, $headers);
echo 'complete';
?>
As you can see I am hard coding pretty much everything. When i change the address it does not work and gives me the error i supplied in the OP.

Thx so far!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users