mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
From: Dave Festing <dave_festing@hotmail.com>
To: ptxdist@pengutronix.de
Subject: [ptxdist] PTXdist PHP5 CLI mail()
Date: Fri, 14 Jun 2013 09:20:33 +0000 (UTC)	[thread overview]
Message-ID: <loom.20130614T104727-646@post.gmane.org> (raw)

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

             reply	other threads:[~2013-06-14  9:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-14  9:20 Dave Festing [this message]
2013-06-20 10:04 ` Dave Festing
     [not found] <mailman.9.1371204002.4501.ptxdist@pengutronix.de>
2013-06-14 10:57 ` Dennis.Herbrich
2013-06-14 11:15   ` Dave Festing

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=loom.20130614T104727-646@post.gmane.org \
    --to=dave_festing@hotmail.com \
    --cc=ptxdist@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox