sendmail problem in Suse 9.2
I'm running Suse Professional 9.2 with apache 2, php4, and sendmail installed. I'm trying to implement a simple email form where a user enters their email and a remark and when they click submit, the form data is emailed to me. I think I have the html and php file correct, but the form info is never emailed to me. Could this be a problem with sendmail. Here is my code:
***HTML FILE*** <form method="post" action="sendmail.php"> Email: <input name="email" type="text" /><br /> Message:<br /> <textarea name="message" rows="15" cols="40"> </textarea><br /> <input type="submit" /> </form> ***HTML FILE*** ***PHP FILE*** <? $email = $_REQUEST['email'] ; $message = $_REQUEST['message'] ; mail( "nobody@free.org", "Feedback Form Results", $message, "From: $email" ); header( "Location: http://www.nobody.com/index.html" ); ?> ***PHP FILE*** Is there anything I'm doing wrong with the code, or is there a certain way to configure sendmail? I checked to see if sendmail was running and it was. Any help would be appreciated. Thanks, Delamatrix |
The code looks fine.
Have you tried putting a print_r($_REQUEST); command in to see whether the PHP page is actually receiving what the user types in? Is the SMTP server set up correctly in php.ini? Also, is the mail command returning true or false? (This should indicate whether it's succeeding at sending the mail). There shouldn't be any special configuration of sendmail required. |
1.) Putting --> print_r($_REQUEST); <-- in the code works.
2.) In the php.ini file, I found the following line: **************** [mail function] ; For Unix only. You may supply arguments as well (default: "sendmail -t -i"). sendmail_path = ****************** Should I type the path to sendmai there? 3.) The following message is created in /var/log/mail log file: Aug 2 12:31:30 serena sendmail[5905]: j72HVUwc005905: from=wwwrun, size=95, class=0, nrcpts=1, msgid=<200508021731.j72HVUwc005905@serena.goldroq.local>, relay=wwwrun@localhost Aug 2 12:31:32 serena sendmail[5906]: j72HVUZL005906: from=<wwwrun@serena.goldroq.local>, size=328, class=0, nrcpts=1, msgid=<200508021731.j72HVUwc005905@serena.goldroq.local>, proto=ESMTP, daemon=Daemon0, relay=localhost [127.0.0.1] Aug 2 12:31:32 serena sendmail[5905]: j72HVUwc005905: to=golden@cnt.org, ctladdr=wwwrun (30/8), delay=00:00:02, xdelay=00:00:02, mailer=relay, pri=30095, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (j72HVUZL005906 Message accepted for delivery) Aug 2 12:31:33 serena sendmail[5908]: j72HVUZL005906: to=<golden@cnt.org>, ctladdr=<wwwrun@serena.goldroq.local> (30/8), delay=00:00:01, xdelay=00:00:01, mailer=esmtp, pri=120328, relay=mailbox.cnt.org. [68.20.235.7], dsn=2.0.0, stat=Sent (Ok: queued as 705A02D9B) Anything looks suspicious here? - Delamatrix |
Yeah, put the path to sendmail in the php.ini file. You'll have to restart the httpd service to get it to reload the file. If it helps, on my system sendmail is /usr/sbin/sendmail.
Quote:
|
All times are GMT -5. The time now is 06:35 PM. |