 |
| Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Beginning PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

December 28th, 2003, 06:17 PM
|
|
Registered User
|
|
Join Date: Dec 2003
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Email In php 4
Hi, I am having problems sending emails using php 4, apache 2, linux. I have set register globals off , safe mode off also.
I want to create an automailer, so when my user signs up the server sends an email to confirm this action. I have used basic script in CH15 of the book, but when i open it up in IE 6 I get the "Failed" from the echo and nothing happens. I have checked my inbox and the send address and nothing is happening.
I can send email fine using POP3, (im using sendmail by the way) i have even added apache to the sendmail trusted users, still no luck.
Anyone any ideas?
|
|

December 29th, 2003, 06:18 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 836
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
What errors, if any, are you getting? What's error_reporting set to? What about display_errors?
While debugging scripts, it helps to have error_reporting set to E_ALL and display_errors set to On.
If you're having problems with mail(), then start small -- try a simple toy script to verify that you can send mail before adding complexity to the script:
<?php
$ret = mail(' [email protected]', 'Test Subject', 'Test Body');
echo "mail() returned: " . ($ret? "TRUE" : "FALSE");
?>
Take care,
Nik
http://www.bigaction.org/
|
|

December 29th, 2003, 06:38 PM
|
|
Registered User
|
|
Join Date: Dec 2003
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
From that basic mail send code...
mail() returned: FALSE
Using my mail script i simply get the message from the else statement, which is something like echo mail failed.
I havnt edited anything in php.ini apart from register globals = On.
|
|

December 29th, 2003, 06:48 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 836
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
So what are your settings for the other two config vars? Like I said, it doesn't make sense to run a script where problems are happening and _NOT_ choose to see all the error output.
When mail() fails, you should get a warning (that is, an E_NOTICE level error) telling you what went wrong.
Take care,
Nik
http://www.bigaction.org/
|
|

December 29th, 2003, 06:49 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 836
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Also, you mentioned that you didn't change anything else in php.ini.... you did set your sendmail_path, right????
Take care,
Nik
http://www.bigaction.org/
|
|

December 30th, 2003, 05:37 AM
|
|
Registered User
|
|
Join Date: Dec 2003
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I only took out the -v option , the rest doesnt matter as im run running on Win32. Like i said i havnt NOT said i wan t error reporting but i dont know where to turn it on, if it isnt on.
EDIT, i just checked and display_errors = On
|
|

December 30th, 2003, 01:58 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 836
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Okay, error_reporting, register_globals, and display_errors are all configuration directives found in php.ini.
And what's this about you running on Win32? You said in your first post that you're running linux.
If you're running on windows, PHP doesn't use sendmail to send outgoing mails. Rather, you need to specify the hostname or IP address of your SMTP server. Most people use "localhost" and install an SMTP server on their machine. Windows 2000 and XP come with IIS which includes an SMTP server.
Take care,
Nik
http://www.bigaction.org/
|
|

December 30th, 2003, 02:57 PM
|
|
Registered User
|
|
Join Date: Dec 2003
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
No. I made a mistake in my last post. I am using linux, with sendmail.
|
|

December 30th, 2003, 04:41 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 836
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
So, you still haven't mentioned what your error_reporting is set to in php.ini. Make sure it's set to E_ALL.
Take care,
Nik
http://www.bigaction.org/
|
|

December 30th, 2003, 09:20 PM
|
|
Registered User
|
|
Join Date: Dec 2003
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
error_reporting = E_ALL & ~E_NOTICE
display_errors = On
|
|
 |