Community Forums
Connect with us on LinkedIn
Community Notice
+ Reply to Thread
Results 1 to 10 of 10
  1. #1
    Member
    Join Date
    Apr 2006
    Posts
    85

    Default PHP mail problem

    hello folks,

    I'm having a serious issue with email forms working using the PHP ()mail function on my box. I'm not even sure when it stopped working, but it just isn't working now and I need to find out why, which is what I need help with.

    I've posted a simple email form below that isn't working either. I get no errors back on the site after I submit, I cannot find any errors in any logs and there is no mails in queue on the server. I'm totally at a loss.

    I'm running:
    Apache version 1.3.37
    PHP version 4.4.4
    MySQL version 5.0.24-standard
    cPanel Build 10.9.0-CURRENT 4

    Code:
    <div>
    	<form method="post" action="<?php $_SERVER['PHP_SELF']; ?>">
    		<p>Name:</p>
    		<input name="name" type="text" />
    		<p>Email:</p>
    		<input name="email" type="text" />
    		<p>Subject:</p>
    		<input name="subject" type="text" />
    		<p>Message:</p>
    		<textarea name="message" rows="6"></textarea>
    		<br />
    		<input type="submit" value="Send" /><input type="hidden" name="do" value="send" /><input type="reset" value="Reset" />
    	</form>
    </div>
    <?php
    
    if($_POST['do']=="send") {
    	$recipient="testing@ezwebsol.com"; // Set your email here //
    	$subject=$_POST['subject'];
    	$name=$_POST['name'];
    	$email=$_POST['email'];
    	$message=$_POST['message'];
    	$formsend=mail("$recipient", "$subject", "$message", "From: $name ($email)\r\nReply-to:$email");
    	echo("Your message was successfully sent!");
    }
    ?>
    So any help I would very much appreciate.

    hamper
    Last edited by hamper; 09-14-2006 at 02:46 PM.
    EZ Web Solutions
    *coming soon*
    EZ Quality Hosting
    -- making your life EZ on the net...

  2. #2
    Member
    Join Date
    Mar 2003
    Posts
    160

    Default

    do a search, I just answered same issue a couple of days ago.

  3. #3
    Member
    Join Date
    Apr 2006
    Posts
    85

    Default

    thanks,

    but that isn't my issue. my dns and hostname are correctly set.
    i can dig, nslookup and ping it just fine and it resolves.

    next?
    EZ Web Solutions
    *coming soon*
    EZ Quality Hosting
    -- making your life EZ on the net...

  4. #4
    Member
    Join Date
    Aug 2006
    Location
    The Netherlands
    Posts
    28

    Default

    its with php security
    open php.ini and look for a line
    Code:
    register_globals
    And make sure its turned on! when its off you cant send mail with php
    Php have register_globals a while ago turned off in there new installations read at:
    www.php.net/register_globals

    Good luck
    http://www.hostingperfect.net where the hosting is perfect!

  5. #5
    Member
    Join Date
    Mar 2003
    Posts
    160

    Default

    what does /var/log/exim_mainlog state?

    tail -f /var/log/exim_mainlog

    Try sending an email, what error do you get? Have you also tried re-compiling php?

  6. #6
    Member
    Join Date
    Apr 2006
    Posts
    85

    Default

    Hi,

    Well the register_globals were turned off so I turned them on and restarted apache and still no difference in getting mail from a form script.

    as to the other question..

    Code:
    blah@george [/home/clancy]# tail -f /var/log/exim_mainlog
    2006-09-15 07:20:04 1GOBjn-0007Nk-Li => username <support@domain.com> R=virtual_user T=virtual_userdelivery
    2006-09-15 07:20:04 1GOBjn-0007Nk-Li Completed
    2006-09-15 08:02:44 Start queue run: pid=1985
    2006-09-15 08:02:44 End queue run: pid=1985
    2006-09-15 09:02:44 Start queue run: pid=10611
    2006-09-15 09:02:44 End queue run: pid=10611
    2006-09-15 10:02:44 Start queue run: pid=19343
    2006-09-15 10:02:44 End queue run: pid=19343
    2006-09-15 11:02:44 Start queue run: pid=27979
    2006-09-15 11:02:44 End queue run: pid=27979
    I've changed certain points, but this is what the output was.
    It seems everything ran and finished fine.

    I'm just really confused as to what the problem is. Anyone?
    EZ Web Solutions
    *coming soon*
    EZ Quality Hosting
    -- making your life EZ on the net...

  7. #7
    Member
    Join Date
    Jul 2003
    Posts
    118

    Default

    Register globals hasn't anything to do with your problem,
    you are not using register globals ($_SERVER['PHP_SELF'], $_POST['do'], etc.. )
    I recomend you to turn it back to off, because in furute php releases register globals will be totally removed.

    On the other hand.
    As far I can see, you don't have phpsuexec, if so, mails are sent by nobody. So go to:
    WHM ->Tweak Settings where you can find:

    Prevent the user "nobody" from sending out mail to remote addresses (PHP and CGI scripts generally run as nobody if you are not using PHPSuexec and Suexec respectively.)

    If that box is checked, thats the reason of why emails are not being delivered.

  8. #8
    Member
    Join Date
    Oct 2005
    Posts
    37

    Default Hi

    hello,

    try that script in shell prompt and see what it is saying....

    # php scriptname.php and also tail the mail log same time in a different shelll
    Anish T S
    Unix system administrator

  9. #9
    Member
    Join Date
    Apr 2006
    Posts
    85

    Default

    Hi,

    where would I check to see if I am running phpsuexec?

    I checked the logs again, and nothing again.

    I checked the settings and no the box wasn't checked.

    I'm really at a loss here. Thinking about it, I tried to
    setup and run the postwwwacct script and I cannot get
    an email back from it either.

    Could it be something with my firewall?

    Thanks again.. anything else you can think of.
    EZ Web Solutions
    *coming soon*
    EZ Quality Hosting
    -- making your life EZ on the net...

  10. #10
    Member
    Join Date
    Apr 2006
    Posts
    85

    Default

    PROBLEM FIXED

    I followed the suggestion of:

    deleted the /etc/eximmailtrap file
    changed /var/cpanel/cpanel.config to make eximmailtrap=0

    and this solved the problem.

    thanks to everyone for your suggestions.

    now I'm off to try to install PHP5
    EZ Web Solutions
    *coming soon*
    EZ Quality Hosting
    -- making your life EZ on the net...

Similar Threads & Tags
Similar threads

  1. nobody@ problem with php mail()
    By blueghozt in forum E-mail Discussions
    Replies: 3
    Last Post: 07-06-2009, 08:37 PM
  2. php mail problem
    By yourwayit in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 06-12-2006, 02:14 AM
  3. Problem with PHP mail
    By salvatore333 in forum cPanel and WHM Discussions
    Replies: 6
    Last Post: 03-11-2006, 11:42 AM
  4. Problem with PHP and E-mail
    By tbutler in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 11-07-2004, 02:11 PM
  5. php mail() problem
    By simonlee in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 04-01-2004, 08:14 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube