mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
* [ptxdist] PTXdist PHP5 CLI mail()
@ 2013-06-14  9:20 Dave Festing
  2013-06-20 10:04 ` Dave Festing
  0 siblings, 1 reply; 4+ messages in thread
From: Dave Festing @ 2013-06-14  9:20 UTC (permalink / raw)
  To: ptxdist

Have been struggling with trying to get PHP's mail() to work in PTXdist
2012.12.0

I can send email using PHP-CLI as follows:

#!/usr/bin/php5

<?php
mail('your_name@hotmail.com', 'Alarm!!', "High temperature", "From:
my_name@clear.net.nz \r\n");
?>

But, when I try to send email from within a PHP block in a webpage the mail
function does not run:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title> Test mail function
</title>
</head>

<body>
<h2>Test mail function</h2>

<?php
if(mail('your_name@hotmail.com', 'Alarm!!', "High temperature", "From:
my_name@clear.net.nz \r\n"))
{
  echo "mail was sent";
}
else
{
  echo "there were errors";
}
?>

</body>
</html>

These both are in the same directory, same permissions and use the same
php.ini file.

In the rule file php5.in and for PHP5_SAPI_CLI the help states:
Build CLI (command line version) of PHP.

Does this mean one ends up with an unique version of PHP that has the added
feature of running CLI or does it mean that if you want to have a "normal"
version of PHP to use in webpages then you have to build a version without CLI?

The CLI version I ended up with seems to work in both BUT not for the mail()
function!

I have also tried PHPmailer and get an error:
Mailer Error: Could not instantiate mail function. 
This confirms to me that the mail() just does not run on the webpage.

Appreciate any suggestions as to the apparently fundamental mistake I am making.

Thanks,
Dave






-- 
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-06-20 10:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <mailman.9.1371204002.4501.ptxdist@pengutronix.de>
2013-06-14 10:57 ` [ptxdist] PTXdist PHP5 CLI mail() Dennis.Herbrich
2013-06-14 11:15   ` Dave Festing
2013-06-14  9:20 Dave Festing
2013-06-20 10:04 ` Dave Festing

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox