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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.