Discussion:
mail() doesn't work
Jim Giner
2014-09-13 16:20:18 UTC
Permalink
ok - here's the scenario. Wrote a script that has been copied several
times with success that traps an email, grabs some input and then sends
me an email. Last week I attempted to make yet another copy of it to
capture a new email address and do the same kind of thing. Should have
been easy, but it's a nightmare.

Let me say that my other instances of this template still work just
fine. It's just this one that doesn't and I'm out of ideas. The same
email call is being used across the board. Here's the code:

$headers[] = "From: $incoming_email";
$headers[] = "Reply-To: $reply_to";
$headers[] = "X-Mailer: PHP/" . phpversion();
$header_str = implode("\r\n", $headers);
$ans_msg = wordwrap($ans_msg, 70, "\r\n");
if (mail($to, $subject, $ans_msg, $header_str))
PostErrorLog("Email sent to $to",$done);
else
PostErrorLog("Email failed");

The function posterrorlog makes a call to error_log to output some
messages since the email is not being sent. The call to mail() actually
returns true yet it never delivers the message. The $to address is the
same one I use in all of my versions of this script. The fact that my
error log contains messages from the script proves that the call
actually gets executed, yet no mail. The mailbox shows nothing on my
host's webmail interface either. It's like the mail goes to thin air.
I have tried it with a simple body of a dummy string value but that
didn't help. The $incoming_email value is the mailbox that I am
capturing mail from and is valid since that is how this script gets
triggered (via a pipe from the email).

So - any really really smart readers out there have any idea why one
script using the same email code won't work?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Robert Cummings
2014-09-13 16:27:03 UTC
Permalink
Post by Jim Giner
ok - here's the scenario. Wrote a script that has been copied several
times with success that traps an email, grabs some input and then sends
me an email. Last week I attempted to make yet another copy of it to
capture a new email address and do the same kind of thing. Should have
been easy, but it's a nightmare.
Let me say that my other instances of this template still work just
fine. It's just this one that doesn't and I'm out of ideas. The same
$headers[] = "From: $incoming_email";
$headers[] = "Reply-To: $reply_to";
$headers[] = "X-Mailer: PHP/" . phpversion();
$header_str = implode("\r\n", $headers);
$ans_msg = wordwrap($ans_msg, 70, "\r\n");
if (mail($to, $subject, $ans_msg, $header_str))
PostErrorLog("Email sent to $to",$done);
else
PostErrorLog("Email failed");
The function posterrorlog makes a call to error_log to output some
messages since the email is not being sent. The call to mail() actually
returns true yet it never delivers the message. The $to address is the
same one I use in all of my versions of this script. The fact that my
error log contains messages from the script proves that the call
actually gets executed, yet no mail. The mailbox shows nothing on my
host's webmail interface either. It's like the mail goes to thin air.
I have tried it with a simple body of a dummy string value but that
didn't help. The $incoming_email value is the mailbox that I am
capturing mail from and is valid since that is how this script gets
triggered (via a pipe from the email).
So - any really really smart readers out there have any idea why one
script using the same email code won't work?
Hi Jim, the mail() function returns true if the message is "accepted for
delivery" and doesn't provide any information about whether it actually
gets sent out. If you are receiving a return status code of true, then
the mail server accepted it. So if you aren't receiving it on the other
end then I would investigate the mail server logs.

You've said the script works in other places, are these on the same
server where you are having problems? Is the target mail server the same
in all cases?

Cheers,
Rob.
--
Phone: 613-822-9060 +++ Cell: 613-600-2836
E-Mail Disclaimer: Information contained in this message and any
attached documents is considered confidential and legally protected.
This message is intended solely for the addressee(s). Disclosure,
copying, and distribution are prohibited unless authorized.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Jim Giner
2014-09-13 16:58:32 UTC
Permalink
Post by Robert Cummings
Post by Jim Giner
ok - here's the scenario. Wrote a script that has been copied several
times with success that traps an email, grabs some input and then sends
me an email. Last week I attempted to make yet another copy of it to
capture a new email address and do the same kind of thing. Should have
been easy, but it's a nightmare.
Let me say that my other instances of this template still work just
fine. It's just this one that doesn't and I'm out of ideas. The same
$headers[] = "From: $incoming_email";
$headers[] = "Reply-To: $reply_to";
$headers[] = "X-Mailer: PHP/" . phpversion();
$header_str = implode("\r\n", $headers);
$ans_msg = wordwrap($ans_msg, 70, "\r\n");
if (mail($to, $subject, $ans_msg, $header_str))
PostErrorLog("Email sent to $to",$done);
else
PostErrorLog("Email failed");
The function posterrorlog makes a call to error_log to output some
messages since the email is not being sent. The call to mail() actually
returns true yet it never delivers the message. The $to address is the
same one I use in all of my versions of this script. The fact that my
error log contains messages from the script proves that the call
actually gets executed, yet no mail. The mailbox shows nothing on my
host's webmail interface either. It's like the mail goes to thin air.
I have tried it with a simple body of a dummy string value but that
didn't help. The $incoming_email value is the mailbox that I am
capturing mail from and is valid since that is how this script gets
triggered (via a pipe from the email).
So - any really really smart readers out there have any idea why one
script using the same email code won't work?
Hi Jim, the mail() function returns true if the message is "accepted for
delivery" and doesn't provide any information about whether it actually
gets sent out. If you are receiving a return status code of true, then
the mail server accepted it. So if you aren't receiving it on the other
end then I would investigate the mail server logs.
You've said the script works in other places, are these on the same
server where you are having problems? Is the target mail server the same
in all cases?
Cheers,
Rob.
It's all my same domain on a shared host. My provider says there is no
problem with the emailbox. I can send emails manually to it and they
are received no problem. The other scripts differ in that they are
triggered by mail coming to a different address. They look for
different things in the emails but then they send an email result to the
same mailbox and work just fine. I suspect it is something I am doing
in this particular script since that is the only variable. I just can't
find it. I have php error checking on; I post error log messages
throughout. No indications at all.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Robert Cummings
2014-09-13 17:55:29 UTC
Permalink
Post by Jim Giner
Post by Robert Cummings
You've said the script works in other places, are these on the same
server where you are having problems? Is the target mail server the same
in all cases?
Cheers,
Rob.
It's all my same domain on a shared host. My provider says there is no
problem with the emailbox. I can send emails manually to it and they
are received no problem. The other scripts differ in that they are
triggered by mail coming to a different address. They look for
different things in the emails but then they send an email result to the
same mailbox and work just fine. I suspect it is something I am doing
in this particular script since that is the only variable. I just can't
find it. I have php error checking on; I post error log messages
throughout. No indications at all.
Since the mail() function is returning true your PHP script appears to
be operating correctly (at least as far as using the mail() function).
Are you sure your script is filling the fields correctly for the mail
function? If you are absolutely certain that the fields are filled
correctly then the culprit must be the mail server (since it's accepting
the mail but not sending it along). Have you tried running a script
known to work elsewhere within the not working environment?

Cheers,
Rob.
--
Phone: 613-822-9060 +++ Cell: 613-600-2836
E-Mail Disclaimer: Information contained in this message and any
attached documents is considered confidential and legally protected.
This message is intended solely for the addressee(s). Disclosure,
copying, and distribution are prohibited unless authorized.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Jim Giner
2014-09-14 00:10:23 UTC
Permalink
On 9/13/2014 1:55 PM, Robert Cummings wrote:
Have you tried running a script
Post by Robert Cummings
known to work elsewhere within the not working environment?
Cheers,
Rob.
Yes . As I said in my post all my other scripts (from the same
template) work just fine. This one for some reason doesn't. Same
domains just different incoming email (which still triggers this script)
but same final email address (mine) to which it doesn't send the
'result' email. Can't figure it out.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Ken Robinson
2014-09-13 16:34:11 UTC
Permalink
Post by Jim Giner
ok - here's the scenario. Wrote a script that has been copied
several times with success that traps an email, grabs some input and
then sends me an email. Last week I attempted to make yet another
copy of it to capture a new email address and do the same kind of
thing. Should have been easy, but it's a nightmare.
Let me say that my other instances of this template still work just
fine. It's just this one that doesn't and I'm out of ideas. The
$headers[] = "From: $incoming_email";
$headers[] = "Reply-To: $reply_to";
$headers[] = "X-Mailer: PHP/" . phpversion();
$header_str = implode("\r\n", $headers);
$ans_msg = wordwrap($ans_msg, 70, "\r\n");
if (mail($to, $subject, $ans_msg, $header_str))
PostErrorLog("Email sent to $to",$done);
else
PostErrorLog("Email failed");
Your web host support people need to look at the mail program's log
files to see why the mail isn't being delivered. Since the mail()
function returned "TRUE" this means that the mail as successfully
sent to the system to be delivered.

Do you have shell access to your host?

If so, you can try something like this: (the "$" is the system
prompt, not part of the command)

$ mail -vvv -s "test mail" to_address_goes_here < /dev/null

This should send a blank email message to the to_address_goes_here address.
The -vvv tells the mail program to be very verbose about writing out
debug messages. These messages might help determining the problem.

Ken
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Jim Giner
2014-09-13 16:59:13 UTC
Permalink
Post by Ken Robinson
Do you have shell access to your host?
Ken
No I do not
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
richard gray
2014-09-13 17:26:28 UTC
Permalink
Post by Jim Giner
Post by Ken Robinson
Do you have shell access to your host?
Ken
No I do not
http://php.net/exec ... are you allowed to run shell commands from PHP?

HTH
Rich
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Jim Giner
2014-09-14 00:10:59 UTC
Permalink
Post by richard gray
Post by Jim Giner
Post by Ken Robinson
Do you have shell access to your host?
Ken
No I do not
http://php.net/exec ... are you allowed to run shell commands from PHP?
HTH
Rich
What do you mean?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
richard gray
2014-09-14 01:11:34 UTC
Permalink
Post by Jim Giner
Post by richard gray
Post by Jim Giner
Post by Ken Robinson
Do you have shell access to your host?
Ken
No I do not
http://php.net/exec ... are you allowed to run shell commands from PHP?
HTH
Rich
What do you mean?
Sorry for not being clear ...can you run shell commands from PHP -- that
would allow you to execute Ken's diagnostics suggestion below:-
Post by Jim Giner
Post by richard gray
mail -vvv -s "test mail" to_address_goes_here < /dev/null
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Jim Giner
2014-09-14 01:20:43 UTC
Permalink
Post by richard gray
Sorry for not being clear ...can you run shell commands from PHP -- that
would allow you to execute Ken's diagnostics suggestion below:-
Post by Ken Robinson
mail -vvv -s "test mail" to_address_goes_here < /dev/null
I do not know of what you speak. I only have a hoster - no php on my
laptop.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
richard gray
2014-09-14 01:46:48 UTC
Permalink
Post by Jim Giner
Post by richard gray
Sorry for not being clear ...can you run shell commands from PHP -- that
would allow you to execute Ken's diagnostics suggestion below:-
Post by Ken Robinson
mail -vvv -s "test mail" to_address_goes_here < /dev/null
I do not know of what you speak. I only have a hoster - no php on my
laptop.
Hmm I am confused here - I was under the impression that sending mails
from your shared host was failing silently... if that is true then Ken
suggested you execute a manual mail command with verbosity switched to
maximum to see if any errors occur when the message is sent to the MTA
(eg sendmail/exim/postfix) on the server.. Ken stated that you would
need shell access to do that and you then replied to say that you did
not have any shell access so I then suggested running a shell command
from a PHP script to execute his diagnostics test - that was all... I
didn't mention your laptop so I am unclear why you think that is
involved...??

sorry for the misunderstanding...
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Aziz Saleh
2014-09-14 03:54:12 UTC
Permalink
Post by richard gray
Post by Jim Giner
Post by richard gray
Post by richard gray
Sorry for not being clear ...can you run shell commands from PHP --
that
would allow you to execute Ken's diagnostics suggestion below:-
Post by richard gray
Post by Ken Robinson
mail -vvv -s "test mail" to_address_goes_here < /dev/null
I do not know of what you speak. I only have a hoster - no php on my
laptop.
Hmm I am confused here - I was under the impression that sending mails
from your shared host was failing silently... if that is true then Ken
suggested you execute a manual mail command with verbosity switched to
maximum to see if any errors occur when the message is sent to the MTA (eg
sendmail/exim/postfix) on the server.. Ken stated that you would need shell
access to do that and you then replied to say that you did not have any
shell access so I then suggested running a shell command from a PHP script
to execute his diagnostics test - that was all... I didn't mention your
laptop so I am unclear why you think that is involved...??
sorry for the misunderstanding...
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
What hosting company are you using?
Jim Giner
2014-09-14 13:01:40 UTC
Permalink
Post by Aziz Saleh
What hosting company are you using?
123
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Jim Giner
2014-09-14 13:01:12 UTC
Permalink
Post by richard gray
Post by Jim Giner
Post by richard gray
Sorry for not being clear ...can you run shell commands from PHP -- that
would allow you to execute Ken's diagnostics suggestion below:-
Post by Ken Robinson
mail -vvv -s "test mail" to_address_goes_here < /dev/null
I do not know of what you speak. I only have a hoster - no php on my
laptop.
Hmm I am confused here - I was under the impression that sending mails
from your shared host was failing silently... if that is true then Ken
suggested you execute a manual mail command with verbosity switched to
maximum to see if any errors occur when the message is sent to the MTA
(eg sendmail/exim/postfix) on the server.. Ken stated that you would
need shell access to do that and you then replied to say that you did
not have any shell access so I then suggested running a shell command
from a PHP script to execute his diagnostics test - that was all... I
didn't mention your laptop so I am unclear why you think that is
involved...??
sorry for the misunderstanding...
Again - I do not understand anything you are talking about here. I
don't know what a 'shell cmd' is. I don't know how to execute a 'manual
mail' command.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
richard gray
2014-09-14 14:02:37 UTC
Permalink
Post by Jim Giner
Again - I do not understand anything you are talking about here. I
don't know what a 'shell cmd' is. I don't know how to execute a
'manual mail' command.
so why don't you try and find out then ... ? :(

http://lmgtfy.com/?q=php+shell+command
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Jim Giner
2014-09-14 14:32:39 UTC
Permalink
Post by richard gray
Post by Jim Giner
Again - I do not understand anything you are talking about here. I
don't know what a 'shell cmd' is. I don't know how to execute a
'manual mail' command.
so why don't you try and find out then ... ? :(
http://lmgtfy.com/?q=php+shell+command
so what will this do for me? It says it will not detect execution
failures. And since the current code indicates that the function
returns true, what am I expected to see from this?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Jeffry Killen
2014-09-14 04:00:27 UTC
Permalink
Post by Jim Giner
Post by richard gray
Sorry for not being clear ...can you run shell commands from PHP -- that
would allow you to execute Ken's diagnostics suggestion below:-
Post by Ken Robinson
mail -vvv -s "test mail" to_address_goes_here < /dev/null
I do not know of what you speak. I only have a hoster - no php on
my laptop.
I have some info that might be useful:
If you have a Mac OSX laptop, it has Apache with php pre-installed.
You have
to edit the http.conf file to turn on php. I believe you can also
install a php CLI (command line interface)

But the command above, I thing would be run from a shell. It can be
run if you
have a mail server installed and working, such as sendmail or Postfix
( I know
there are several other MTA's such as exim4 and others but I don't
have any
experience with them). So the 'mail' shell command would call the
resident MTA.

I don't have any experience with Windows platform but there are
Windows compatible
unix shell commands. I think you have to hunt them down and install them

Any Unix based platform should understand this on the command line
(assuming, like
I said, Sendmail or Postfix are present), including Mac OSX.
Post by Jim Giner
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Jim Giner
2014-09-14 13:02:32 UTC
Permalink
Post by Jim Giner
Post by richard gray
Sorry for not being clear ...can you run shell commands from PHP -- that
would allow you to execute Ken's diagnostics suggestion below:-
Post by Ken Robinson
mail -vvv -s "test mail" to_address_goes_here < /dev/null
I do not know of what you speak. I only have a hoster - no php on my
laptop.
If you have a Mac OSX laptop, it has Apache with php pre-installed. You
have
to edit the http.conf file to turn on php. I believe you can also
install a php CLI (command line interface)
But the command above, I thing would be run from a shell. It can be run
if you
have a mail server installed and working, such as sendmail or Postfix (
I know
there are several other MTA's such as exim4 and others but I don't have any
experience with them). So the 'mail' shell command would call the
resident MTA.
I don't have any experience with Windows platform but there are Windows
compatible
unix shell commands. I think you have to hunt them down and install them
Any Unix based platform should understand this on the command line
(assuming, like
I said, Sendmail or Postfix are present), including Mac OSX.
Post by Jim Giner
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
I know nothing about what you are talking about - As I Said earlier. I
write a script. I upload it to my host. I test it and put it into my
prod setup at the host.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Jim Giner
2014-09-14 00:20:17 UTC
Permalink
Post by richard gray
Post by Jim Giner
Post by Ken Robinson
Do you have shell access to your host?
Ken
No I do not
http://php.net/exec ... are you allowed to run shell commands from PHP?
HTH
Rich
I should mention that as part of my debugging I had added some code to
fake the email trigger and do the same task from a browser with fake
email input from an array I created in it. The script then echos out
progress statements thru the whole process and that triggers the final
email and it does get received. But turn the 'fake' switch off and let
a real email trigger it and it does all it is supposed to do but the
final mail does not get delivered. It's almost like this one script
does not have permission to send a mail. There is nothing monumentally
odd here - it just reads stdin for the email line by line, look for
certain info and post a mysql db and then send an email to let me know
if ran successfully (or not).
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Richard
2014-09-14 14:13:00 UTC
Permalink
This post might be inappropriate. Click to display it.
Jim Giner
2014-09-14 14:48:34 UTC
Permalink
Post by Richard
------------ Original Message ------------
Date: Saturday, September 13, 2014 12:20:18 -0400
Subject: [PHP] mail() doesn't work
ok - here's the scenario. Wrote a script that has been copied
several times with success that traps an email, grabs some input
and then sends me an email. Last week I attempted to make yet
another copy of it to capture a new email address and do the same
kind of thing. Should have been easy, but it's a nightmare.
Let me say that my other instances of this template still work
just fine. It's just this one that doesn't and I'm out of ideas.
The same email call is being used across the board. Here's the
$headers[] = "From: $incoming_email";
$headers[] = "Reply-To: $reply_to";
$headers[] = "X-Mailer: PHP/" . phpversion();
$header_str = implode("\r\n", $headers);
$ans_msg = wordwrap($ans_msg, 70, "\r\n");
if (mail($to, $subject, $ans_msg, $header_str))
PostErrorLog("Email sent to $to",$done);
else
PostErrorLog("Email failed");
The function posterrorlog makes a call to error_log to output some
messages since the email is not being sent. The call to mail()
actually returns true yet it never delivers the message. The $to
address is the same one I use in all of my versions of this
script. The fact that my error log contains messages from the
script proves that the call actually gets executed, yet no mail.
The mailbox shows nothing on my host's webmail interface either.
It's like the mail goes to thin air. I have tried it with a simple
body of a dummy string value but that didn't help. The
$incoming_email value is the mailbox that I am capturing mail from
and is valid since that is how this script gets triggered (via a
pipe from the email).
So - any really really smart readers out there have any idea why
one script using the same email code won't work?
It's possible that you're running into an SPF records/rules issue.
SPF records/rules are set up to indicate the authorized mail servers
for a domain. Technically, mail sent "from" that domain from any
other mail server is considered suspect/forged. The rules for a
domain indicate how the receiving mail server should handle messages
that fail the domain's SPF rules. The receiving mail server can
ignore these rules if they wish, but at the strict end of things,
the mail is rejected.
In your code you are taking mail from domain "A" and then resending
through your server. If there are strict SPF records in place for
domain "A" and your target server (the mail server for the "To:")
follows them, the messages will be rejected.
Because you are rewriting the "From:" to send from "A", rejects will
go back there, rather than to your hosting mailboxes.
You can ask "A" (the user on the "To:") if they are getting anything
back -- that's where most rejects would go, whether an SPF issue,
spam or something else. If they aren't, or if that doesn't shed
sufficient light, then you really need to talk with your hosting
provider to get them to look at their mail logs.
Assuming, as you do, that your code works, it is almost impossible
to debug mail delivery issues without more knowledge and access. The
non-delivery of a message tells you almost nothing (especially as in
your case where any bounces are likely to go to mailboxes you don't
seem to control). There are way too many moving parts in mail
deliver, and then the added issue of the redirection you're doing,
to do more than guess (as my SPF ides is) when the only known
element is "the mail goes to thin air".
- Richard
The mailbox setup to pipe to my script is in domain B. The script runs
and tries to send an email to a different mailbox in domain A with a
From mailbox of the address that triggered the script (in domain B).
The reply address is the same as the To address (in domain A). The two
domains are on the same server - I think. Domain B is a subdomain of
domain A (or 'add-on domain').

Again - this whole process works just fine for several other tasks that
I perform with variations of this script. It is just this one mailbox
(using all the same domains) that fails me.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Jim Giner
2014-09-14 15:01:54 UTC
Permalink
Eureka!!

Suddenly (after processing 8 emails this morning) my script has sent me
an email. Eight previous processes failed to deliver but the last one
sent me a response! Just Like It Should. I have since conducted 3 more
tests with it and they have all arrived too. This has all occurred
without any editing on my part, since I long ago gave up on tweaking it.

I have an inquiry in to my host TS to see if they dug something up as I
have asked them to do several times.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Jim Giner
2014-09-26 16:00:09 UTC
Permalink
Sorry - I should have followed up here sooner. My last "Eureka" post
was a false alarm as the emails suddenly stopped arriving shortly after
the post. And since then no progress had been made, except for 1 or two
emails that magically appeared during that time.

BUT TODAY - today is a whole new story.

Looking back at my template that I use for these email processors I
realized that the only difference in this usage was that I dropped the
logic that handled the deletion of the email that was received and
processed by the script. Just figured I'd leave the emails in their
mailbox for future reference and so I stripped out a single function and
the boolean var that triggered a call to it. That's all - a single
function.

Well - now my script works perfectly. Ran two dozen tests over a couple
hours and every one produced an email response.

But - the real killer is this: I receive an email response regardless
of whether I set my boolean switch (to perform the delete) to 'true' or
'false'! Crazy!! Yes - the emails work just fine whether or not the
delete code executes or not. Just having it present in the script makes
the email send work.

Trust me - completely irrational behavior but I'm happy it works.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Robert Cummings
2014-09-26 16:36:29 UTC
Permalink
Post by Jim Giner
Sorry - I should have followed up here sooner. My last "Eureka" post
was a false alarm as the emails suddenly stopped arriving shortly after
the post. And since then no progress had been made, except for 1 or two
emails that magically appeared during that time.
BUT TODAY - today is a whole new story.
Looking back at my template that I use for these email processors I
realized that the only difference in this usage was that I dropped the
logic that handled the deletion of the email that was received and
processed by the script. Just figured I'd leave the emails in their
mailbox for future reference and so I stripped out a single function and
the boolean var that triggered a call to it. That's all - a single
function.
Well - now my script works perfectly. Ran two dozen tests over a couple
hours and every one produced an email response.
But - the real killer is this: I receive an email response regardless
of whether I set my boolean switch (to perform the delete) to 'true' or
'false'! Crazy!! Yes - the emails work just fine whether or not the
delete code executes or not. Just having it present in the script makes
the email send work.
Trust me - completely irrational behavior but I'm happy it works.
Do you have quotes around true and false as shown above? If you do, then
both evaluate to true. Just saying in case it's the root of the craziness :)

Cheers,
Rob.
--
Phone: 613-822-9060 +++ Cell: 613-600-2836
E-Mail Disclaimer: Information contained in this message and any
attached documents is considered confidential and legally protected.
This message is intended solely for the addressee(s). Disclosure,
copying, and distribution are prohibited unless authorized.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Tim Streater
2014-09-14 15:18:00 UTC
Permalink
Post by Jim Giner
Post by richard gray
Post by Jim Giner
Again - I do not understand anything you are talking about here. I
don't know what a 'shell cmd' is. I don't know how to execute a
'manual mail' command.
so why don't you try and find out then ... ? :(
http://lmgtfy.com/?q=php+shell+command
so what will this do for me? It says it will not detect execution
failures. And since the current code indicates that the function
returns true, what am I expected to see from this?
ISTM that what you need, and don't have, is a local environment where you can test what you're doing. Since you haven't told us (unless you did and I missed it) what OS your laptop is running, it's a bit hard to indicate how to set that up. But under OS X, f'rinstance, you'd run the Terminal program, which gives you a command line prompt, at which you can start interactive PHP:

Second-Mini% php -a
Interactive shell

php >

at which you could enter some of the commands people have given in earlier emails. I'm a bit surprised that (unless I'm missing something), you appear not to have a test environment.

BTW, for the avoidance of doubt, I should state that I personally hate most unix shell commands. From time to time I have a fit of activity and decide to "learn unix", but on each occasion after five minutes I develop this desire to throw my computer out of the window. I then sink back into my habitual sloth. Notwithstanding this, I have gleaned enough to be able to use a terminal window for a lot of local testing using, I imagine, a shell.

Recently I dabbled with the Windows command line, in order to develop a Win7 version of my email client. I concluded that the unix shell is about 1,000,000 times better that the Windows shell (plus/minus 10%).
--
Cheers -- Tim
Loading...