Jump to content

Error in sending an email with the mail() command


Xurion

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 <[email protected]>: 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.
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 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 [email protected], 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", "[email protected]");
$mailfrom = "[email protected]";
$mailto = "[email protected]";

$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!

Archived

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

×
×
  • Create New...

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.