By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,949 Members | 2,043 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,949 IT Pros & Developers. It's quick & easy.

Strange php mail problem

P: n/a
I am having a very strange problem sending email with php. I have two
domains. I can send an email to one domain using php but not the
other. If I put both email addresses in the mail command only the one
email will arrive. I can send emails the traditional way to the
problem domain and they arrive fine. Is there anything that might
explain this?

_______
Free Windows Clipboard Utility
http://www.clipboardmagic.com/
Jul 26 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
On Tue, 26 Jul 2005 19:57:23 GMT, Mike the Canadian
<in*********@spam-killer-remove-techie.com> wrote:
I am having a very strange problem sending email with php. I have two
domains. I can send an email to one domain using php but not the
other. If I put both email addresses in the mail command only the one
email will arrive. I can send emails the traditional way to the
problem domain and they arrive fine. Is there anything that might
explain this?


Yes, but it'd only be a guess without more information, since there's lots of
things that could explain it (bugs in your code, misconfigured mail servers,
correctly configured mailservers rejecting the mail because of how you've sent
it, etc.)

--
Andy Hassall / <an**@andyh.co.uk> / <http://www.andyh.co.uk>
<http://www.andyhsoftware.co.uk/space> Space: disk usage analysis tool
Jul 26 '05 #2

P: n/a
Andy Hassall <an**@andyh.co.uk> wrote:
On Tue, 26 Jul 2005 19:57:23 GMT, Mike the Canadian
<in*********@spam-killer-remove-techie.com> wrote:
I am having a very strange problem sending email with php. I have two
domains. I can send an email to one domain using php but not the
other. If I put both email addresses in the mail command only the one
email will arrive. I can send emails the traditional way to the
problem domain and they arrive fine. Is there anything that might
explain this?


Yes, but it'd only be a guess without more information, since there's lots of
things that could explain it (bugs in your code, misconfigured mail servers,
correctly configured mailservers rejecting the mail because of how you've sent
it, etc.)


How can it be bugs in my code when it works for one address but not
the other? How can it be a misconfigured mail server when sending
email the traditional way works just fine? Why would one server reject
the mail because of how I sent it when the other will not reject it?

See below as to how I am sending the email:

@mail( "$myrow[1]", "password request","You had requested your
password to be sent to you. You can find your password
below.\n\nPassword: $myrow[0]", "From: Mail Admin <ad***@acme.co>");

Yes $myrow[0] and $myrow[1] are fine, I checked.

_______
Free Windows Clipboard Utility
http://www.clipboardmagic.com/
Jul 27 '05 #3

P: n/a
in*********@spam-killer-remove-techie.com says...
How can it be bugs in my code when it works for one address but not
the other? How can it be a misconfigured mail server when sending
email the traditional way works just fine? Why would one server reject
the mail because of how I sent it when the other will not reject it?

See below as to how I am sending the email:

@mail( "$myrow[1]", "password request","You had requested your
password to be sent to you. You can find your password
below.\n\nPassword: $myrow[0]", "From: Mail Admin <ad***@acme.co>");


Some mail servers will reject mail where an attempt to set a value for the
"from" address in the header (as you have done) is in conflict with the
message's canonical from address (likely to be apache@yourserver).

Try it using the optional fifth parameter in PHP's mail function:
$param='-fad***@acme.co'; // the -f at the front of the address is needed
mail($to, $subject, $body, $headers, $param);
and see if that fixes it.

Geoff M
Jul 27 '05 #4

P: n/a
>How can it be bugs in my code when it works for one address but not
the other? How can it be a misconfigured mail server when sending
email the traditional way works just fine? Why would one server reject
the mail because of how I sent it when the other will not reject it?


If your From: line doesn't indicate a mailbox you can ACTUALLY SEND
MAIL (specifically, a bounce message) TO, some servers will reject
it. Some mail servers, but not others, may have your web server
on their spam block list. If the mail contains the line: To:
<Undisclosed Recipients:;> some mail servers will reject it. If
your From: address isn't on the right whitelist, some mail servers
will reject it. In the Age of Spam, it's a wonder you can send
email at all.

Gordon L. Burditt
Jul 27 '05 #5

P: n/a
Geoff Muldoon <ge***********@trap.gmail.com> wrote:
in*********@spam-killer-remove-techie.com says...
How can it be bugs in my code when it works for one address but not
the other? How can it be a misconfigured mail server when sending
email the traditional way works just fine? Why would one server reject
the mail because of how I sent it when the other will not reject it?

See below as to how I am sending the email:

@mail( "$myrow[1]", "password request","You had requested your
password to be sent to you. You can find your password
below.\n\nPassword: $myrow[0]", "From: Mail Admin <ad***@acme.co>");


Some mail servers will reject mail where an attempt to set a value for the
"from" address in the header (as you have done) is in conflict with the
message's canonical from address (likely to be apache@yourserver).

Try it using the optional fifth parameter in PHP's mail function:
$param='-fad***@acme.co'; // the -f at the front of the address is needed
mail($to, $subject, $body, $headers, $param);
and see if that fixes it.


Weird, using -f I now get an "Unrouteable address" bounce.

_______
Free Windows Clipboard Utility
http://www.clipboardmagic.com/
Jul 27 '05 #6

P: n/a
in*********@spam-killer-remove-techie.com says...
Some mail servers will reject mail where an attempt to set a value for the
"from" address in the header (as you have done) is in conflict with the
message's canonical from address (likely to be apache@yourserver).

Try it using the optional fifth parameter in PHP's mail function:
$p*************@acme.co'; // the -f at the front of the address is needed
mail($to, $subject, $body, $headers, $param);
and see if that fixes it.


Weird, using -f I now get an "Unrouteable address" bounce.


On the target address that used to fail using your initial method, or
both?

One of the upsides to using the -f param method is that bounces are likely
to be returned to the nominated -f address whereas using your initial
method they may well have just gone to the apache account. If mail to
that apache account wasn't been set to /dev/null see if your initial
method was always bouncing mail to that address as well. If so, I suspect
it's a host/DNS problem between your PHP server and that target server.

Geoff M
Jul 27 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.