Jump to content

Archived

This topic is now archived and is closed to further replies.

Xurion

Error in sending an email with the mail() command

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
[quote author=lonewolf277 link=topic=112907.msg458486#msg458486 date=1161941428]
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?
[/quote]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:
[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';
?>[/code]
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!

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.