Have-Host and PHP mail()

Hi,

Sorry for being a bit off-topic.

I have an account with Have-Host which supports PHP/MySQL etc.

Any mail() statement sent from within a PHP never gets received by the recipient. I wonder if anyone else is using this in Have-Host and can shed any (configuration) light on the matter?

James@Have-Host has tried to help and pointed me in some useful form script directions but I really want to get this working within PHP is possible.

Thanks,

John


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Take a look at the code you are using. If you aren’t using all of the
variables in your call to the mail function, you might want to do that.

mail($to,$subject,$body,$headers,$extra)

$to, $subject, and $body are hopefully self-explanatory.

In $headers, send a newline-separated string of headers. I usually
send at least From: headers, which look like this:

From: "Person Name" <person @ domain.com>

(without the spaces, naturally.)

In the $extra field, be sure to add an -f flag, meaning sendmail
from. It should look like this:

-fperson @ domain.com

(no spaces around the at sign, again, but note also no space between
the -f flag and the address that follows it.

Walter

On Mar 13, 2008, at 4:32 PM, johnrob wrote:

Hi,

Sorry for being a bit off-topic.

I have an account with Have-Host which supports PHP/MySQL etc.

Any mail() statement sent from within a PHP never gets received by
the recipient. I wonder if anyone else is using this in Have-Host
and can shed any (configuration) light on the matter?

James@Have-Host has tried to help and pointed me in some useful
form script directions but I really want to get this working within
PHP is possible.

Thanks,

John


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

This is my full statment:

mail(“email@hidden”, “You have received an enquiry from the xxx website”, “$message”, “From: Website enquiry <email@hidden”, “email@hidden”);

Should this work on any server that is running PHP, like Have-Host? Is the error in my code or in the PHP configuration, or something?

Thanks again Walter. Time to contribute to your fund soon - how do I do this?


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

The only thing that looks funny here is the From header. Try this:

‘From: “Website enquiry” email@hidden

Note the single and double-quotes.

Ask Have-Host if they can watch the mail log while you try it. The
only thing I can imagine here is that the -f flag is not working as
it should, and maybe that has something to do with which address you
are sending as. But that should be visible in the logs, which an
admin can watch in real-time while the script is trying to send it.

Walter

On Mar 13, 2008, at 5:17 PM, johnrob wrote:

This is my full statment:

mail(“email@hidden”, “You have received an enquiry from the
xxx website”, “$message”, “From: Website enquiry
<email@hidden”, “email@hidden”);

Should this work on any server that is running PHP, like Have-Host?
Is the error in my code or in the PHP configuration, or something?

Thanks again Walter. Time to contribute to your fund soon - how do
I do this?


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

You could try this, just to see what’s returned as a matter of
interest…

if (mail(“email_address”, etc.etc.etc. ) {
echo 'Message sent";
} else {
echo 'Message not sent";
}

It’s not the be-all and end-all of checking the function but at least
you will know if in pricipal all is correct.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

If the mail isn’t getting through, I doubt that the problem is
precisely at this point. That’s why the -f flag is of such importance
here. Most likely the problem is happening further along the path,
where one mail server hands off to another. And that’s precisely
where the authorization of the sender comes into question. The mail()
function almost always returns true. And that’s useless information
when trying to figure out why the message never arrives.

Walter

On Mar 13, 2008, at 6:36 PM, Mike B wrote:

You could try this, just to see what’s returned as a matter of
interest…

if (mail(“email_address”, etc.etc.etc. ) {
echo 'Message sent";
} else {
echo 'Message not sent";
}

It’s not the be-all and end-all of checking the function but at least
you will know if in pricipal all is correct.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Suredetecting, but it was more of a suggestion to see if it was
actually being sent rather than detecting a problem of it not getting
through, which it wouldn’t actually do if it wasn’t getting sent in
the first place. I have found this to have helped me in the past if
making some mistakes in the structure of any variable values used
within the function.

On Mar 14, 2008, at 12:42 AM, Walter Lee Davis wrote:

If the mail isn’t getting through, I doubt that the problem is
precisely at this point. That’s why the -f flag is of such importance
here. Most likely the problem is happening further along the path,
where one mail server hands off to another. And that’s precisely
where the authorization of the sender comes into question. The mail()
function almost always returns true. And that’s useless information
when trying to figure out why the message never arrives.

Walter

On Mar 13, 2008, at 6:36 PM, Mike B wrote:

You could try this, just to see what’s returned as a matter of
interest…

if (mail(“email_address”, etc.etc.etc. ) {
echo 'Message sent";
} else {
echo 'Message not sent";
}

It’s not the be-all and end-all of checking the function but at least
you will know if in pricipal all is correct.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Ah. Good point, I overlooked the obvious.

Walter

On Mar 13, 2008, at 7:53 PM, Mike B wrote:

Suredetecting, but it was more of a suggestion to see if it was
actually being sent rather than detecting a problem of it not getting
through, which it wouldn’t actually do if it wasn’t getting sent in
the first place. I have found this to have helped me in the past if
making some mistakes in the structure of any variable values used
within the function.

On Mar 14, 2008, at 12:42 AM, Walter Lee Davis wrote:

If the mail isn’t getting through, I doubt that the problem is
precisely at this point. That’s why the -f flag is of such importance


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options