On Fri, 21 Jan 2011 12:28:16 +0700, Paul M Foster
<paulf@xxxxxxxxxxxxxxxxx> wrote:
On Fri, Jan 21, 2011 at 10:45:46AM +0700, Paul S wrote:
I am having problems with mail(). The problem is that the email just
never
gets there. Mail appears to be working. To start, I am investigating the
SMTP server. I can't understand some things.
1) I am sure that the smtp server is and is set to "localhost", but I
want
to verify this ...
-------------------------------------------------------------------------------------------
error_reporting(E_ALL);
echo 'display_errors = ' . ini_get('display_errors') . "\n";
echo 'register_globals = ' . ini_get('register_globals') . "\n";
echo "<br><br>";
echo "SMTP host: " . ini_get("smtp");
echo "SMTP port: " . ini_get("smtp_port");
echo "Sendmail From: " . ini_get("sendmail_from");
gets:
1 1
SMTP host:
SMTP port: 25
Sendmail_from:
Notice: Use of undefined constant sendmail_from - assumed
'sendmail_from'
in /home/
Obviously SMTP is defined (?? because it is not undefined?), but nothing
is echo'd for SMTP. WHY?
Think CASE-SENSITIVE. Check instead for SMTP, not smtp.
YES! I started with SMTP. Same result. I then switched to smtp lower case.
Switched back. Both same. I'm sorry, I should have indicated that I tried
both.
Still. No result from echo.
sendmail_from is not defined on my machine either, for what it's worth.
No problem here either. I just would like to know so that I can be sure to
define it. Get's time-consuming when you can't just type in "php info".
-------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------
then ...
ini_set( smtp, "localhost" );
gets:
Notice: Use of undefined constant smtp - assumed 'smtp' in /home/ ...
SMTP host:
SMTP port: 25
Sendmail_from:
-------------------------------------------------------------------------------------------
Strange, SMTP was defined before ????, and it still won't echo.
-------------------------------------------------------------------------------------------
Again, think case-sensitive. smtp is not a valid ini variable. SMTP is.
-------------------------------------------------------------------------------------------
Both
error_reporting(E_ALL);
ini_set( sendmail_from, "<sendmailfrom>@<localhost>" );
echo "SMTP host: " . ini_get("smtp");
echo "SMTP port: " . ini_get("smtp_port");
echo "Sendmail From: " . ini_get("sendmail_from");
$return = mail('<another user>@<localhost>', 'Test', 'Test');
The above is not a valid email address, as it contains a space. Not to
mention, I'm not real sure about the brackets. Just use a regular email
address without all the other stuff, as: jimbob@xxxxxxxxxxxx
var_dump($return);
and
error_reporting(E_ALL);
ini_set( sendmail_from, "<sendmailfrom>@<localhost>" );
ini_set( smtp, "localhost" );
echo "SMTP host: " . ini_get("smtp");
echo "SMTP port: " . ini_get("smtp_port");
echo "Sendmail From: " . ini_get("sendmail_from");
$return = mail('<another user>@<localhost>', 'Test', 'Test');
var_dump($return);
return
no other errors
SMTP host:
SMTP port: 25
Sendmail_from: <sendmailfrom>@<localhost>
and
bool(true)
Although the documentation isn't entirely clear, I suspect that the
return of true from the mail() function only means that the smtp server
accepted the email for delivery. The smtp server on localhost still has
to connect with the remote server and the remote server has to accept
the mail for delivery. I suspect the return of true only means that the
origin/localhost mailserver accepts the email. It can still fail beyond
there.
YES YES. Same as on my PC with a windows mail server. There it DOES get to
the SMTP server. My BIGGEST problem is, of course, how to figure out why
it does not get to gmail.com or roadrunner.com or even my own UNIX
server's email. It is the same email (text, recip, etc.). My PC server
DOES forward the email to ALL addresses. My UNIX server I never get the
SAME messages.
But on my PC is IS forwarded to all email servers.
Yet NO EMAIL is ever received/returned at the local email address or
when
outside email addresses are used, and never when mail() is seemingly
successfully used in a script.
WHY can't I echo the SMTP address being USED? What am I doing wrong?
(Please note that phpinfo IS DISABLED ON MY SERVER BECAUSE IT IS A
SECURITY THREAT)
How am I going to get this emailing straightened out?
I haven't seen a real email address used yet in your examples. Use a
real address, and not a "localhost" one. A localhost address is likely
not a valid one.
The real addressses mentioned are in fact my personal email address at
gmail.com and roadrunner.com and are "coded" here for obvious reasons. My
"localhost" email addresses are at my unix server and are "coded" because
I don't want to involve them specifucally. Trust me, I got those right.
Thanks for your feedback which is all warranted advice on this. I agree
that I believe that mail() success is only to the SMTP server and not
beyond.
But I am still wondering why SMTP and smtp will not echo and, most
importantly, how to get beyond the SMTP server, which is obviously not
forwarding.
--
Using Opera's revolutionary email client: http://www.opera.com/mail/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php