cancel
Showing results for 
Search instead for 
Did you mean: 

ccgi - php mail problem

andydg
Grafter
Posts: 46
Thanks: 10
Registered: ‎16-03-2010

ccgi - php mail problem

Hi, not sure if this is a new topic or one to add to the rest. My site seems to be working ok with PHP 5 except for my send mail routine. No errors produced by the 'mail()' call - but no emails arriving. This worked fine under php 4 ... any clues?
9 REPLIES 9
ptanser
Newbie
Posts: 2
Registered: ‎24-04-2008

Re: ccgi - php mail problem

Hi
I am also have the exact same problem, no errors reported, but no emails are recieved.

Please Help ASAP

Thanks
Gabe
Community Veteran
Posts: 767
Registered: ‎29-10-2008

Re: ccgi - php mail problem

mail() itself seems to be working. Try:

<?php
$to      = 'your@self.co.uk';
$subject = 'Test Mail';
$message = 'hello';
$headers = 'From: postmaster@username.plus.com' . "\r\n" .
    'Reply-To: postmaster@username.plus.com' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
?>

suitably edited.
Presumably some other deprecated code causing it to fail.
Gabe
Ben_Brown
Grafter
Posts: 2,839
Registered: ‎13-06-2007

Re: ccgi - php mail problem

I've just tested this on my own cgi space and it seems to work fine, I received the test email I sent to a gmail account.
I notice Gabe has been setting the headers fully in his example, I would definitely recommend that in your code if it's not done already.
yellowduck
Newbie
Posts: 6
Registered: ‎16-03-2010

Re: ccgi - php mail problem

also having problems with mail. Interested in any solutions before, I dig too deep (read, waste too much time).
cheers.
andydg
Grafter
Posts: 46
Thanks: 10
Registered: ‎16-03-2010

Re: ccgi - php mail problem

Ok - I have tried this quite a few times ... the mail to my force9 account refuses to arrive (I have tried combinations of my domain names too) but the googlemail 'send' arrives straight away - what's that about Huh
This is the code I am testing with ..
Mail test ..
<?php
$to      = 'vintageview.uk@googlemail.com';
$subject = 'Test Mail';
$message = 'hello';
$headers = 'From: postmaster@degree7.force9.co.uk' . "\r\n" .
    'Reply-To: postmaster@degree7.force9.co.uk' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
echo "mail 1 sent ..";
$to      = 'info@degree7.force9.co.uk';
$subject = 'Test Mail';
$message = 'hello';
$headers = 'From: postmaster@degree7.force9.co.uk' . "\r\n" .
    'Reply-To: postmaster@degree7.force9.co.uk' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
echo "mail 2 sent";
?>
So I get the first mail sent to my googlemail account .. but the second to my force9 account is nowhere to be seen ...
bobpullen
Community Gaffer
Community Gaffer
Posts: 14,884
Thanks: 2,489
Fixes: 168
Registered: ‎04-04-2007

Re: ccgi - php mail problem

See my post here.

Bob Pullen
Plusnet Product Team
If I've been helpful then please give thanks ⤵

andydg
Grafter
Posts: 46
Thanks: 10
Registered: ‎16-03-2010

Re: ccgi - php mail problem

Just a thought - as mails to external clients - like googlemail - seem to work, is it possible that the plusnet mail servers are finding something in the php 5 mail they don't like, and sending it into a spam 'black hole'  Huh
yellowduck
Newbie
Posts: 6
Registered: ‎16-03-2010

Re: ccgi - php mail problem

just had another go, and mail got through. Looks like we might be back in business, fingers crossed.
bobpullen
Community Gaffer
Community Gaffer
Posts: 14,884
Thanks: 2,489
Fixes: 168
Registered: ‎04-04-2007

Re: ccgi - php mail problem

Yep, should now be working again! Smiley

Bob Pullen
Plusnet Product Team
If I've been helpful then please give thanks ⤵