Koozali.org: home of the SME Server

php mail function does not work

Offline Maniac

  • *
  • 15
  • +0/-0
php mail function does not work
« on: August 18, 2009, 05:19:37 PM »
hi everyone,
I have a similar problem to this topic: http://forums.contribs.org/index.php/topic,22103.0.html
(I would have answered this but somehow it is not answerable..)

The php mail-function doesn't work, and no errors are displayed.
Report php-errors is activated, but if I click on "send" it simply clears up all input fields and no error message is shown, not in the browser and not in the messages.log.

Port 25 is forwarded, so what can it be  ?

the following php skript was used (I got it from a php tutorial, so it should work):

<?php
   
    if ( isset( $_REQUEST["do"] ) && $_REQUEST["do"] == "send" )
    {
   // Variablen auslesen
   $to   =   $_REQUEST["form_to"];
   $from   =   $_REQUEST["form_from"];
   $subject =   $_REQUEST["form_subject"];
   $text   =   $_REQUEST["form_text"];

   $header   =   "From: " . $from;
   
   // Pflichtfelder
   if ( !isset( $to ) || $to = "" )
   {
       die("Bitte geben Sie einen Adressaten an!");
   }
   
   if ( !isset( $subject ) || $subject = "" )
   {
       die("Bitte geben Sie ein Betreff an!");
   }

   $status = mail($to, $subject, $text, $header);
   
   if ( ! $status )
   {
       die("Konnte die Email nicht versenden");
   }
   
    }


?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>

   <head>
      <meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
      <meta name="generator" content="Adobe GoLive 6">
      <title>PHP-Emailer</title>
      <style type="text/css" media="screen"><!--
body { font-family: Arial, Helvetica, Geneva, Swiss, SunSans-Regular }
--></style>
   </head>

   <body bgcolor="#ffffff">
      <form action="<?php echo $_REQUEST["PHP_SELF"]; ?>" method="POST" name="FormName">
         <table border="0" cellspacing="0" cellpadding="2">
            <tr>
               <td align="left" valign="top" width="84">An</td>
               <td align="left" valign="top" width="22">&nbsp;</td>
               <td align="left" valign="top" width="401"><input type="text" name="form_to" size="53" border="0"></td>
            </tr>
            <tr>
               <td align="left" valign="top" width="84">Von</td>
               <td align="left" valign="top" width="22">&nbsp;</td>
               <td align="left" valign="top" width="401"><input type="text" name="form_from" size="53" border="0"></td>
            </tr>
            <tr>
               <td align="left" valign="top" width="84">&nbsp;</td>
               <td align="left" valign="top" width="22">&nbsp;</td>
               <td align="left" valign="top" width="401">&nbsp;</td>
            </tr>
            <tr>
               <td align="left" valign="top" width="84">Subject</td>
               <td align="left" valign="top" width="22">&nbsp;</td>
               <td align="left" valign="top" width="401"><input type="text" name="form_subject" size="53" border="0"></td>
            </tr>
            <tr>
               <td align="left" valign="top" width="84">&nbsp;</td>
               <td align="left" valign="top" width="22">&nbsp;</td>
               <td align="left" valign="top" width="401">&nbsp;</td>
            </tr>
            <tr>
               <td align="left" valign="top" width="84">Body</td>
               <td align="left" valign="top" width="22">&nbsp;</td>
               <td align="left" valign="top" width="401"><textarea name="form_text" rows="7" cols="53"></textarea></td>
            </tr>
            <tr>
               <td align="left" valign="top" width="84">&nbsp;</td>
               <td align="left" valign="top" width="22">&nbsp;</td>
               <td align="left" valign="top" width="401">&nbsp;</td>
            </tr>
            <tr>
               <td align="left" valign="top" width="84"></td>
               <td align="left" valign="top" width="22"><input type="hidden" name="do" value="send"></td>
               <td align="left" valign="top" width="401"><input type="submit" name="submitButtonName" value="senden" border="0"></td>
            </tr>
         </table>
      </form>
      <p></p>
   </body>

</html>

Offline CharlieBrady

  • *
  • 6,918
  • +3/-0
Re: php mail function does not work
« Reply #1 on: August 18, 2009, 08:43:29 PM »
the following php skript was used (I got it from a php tutorial, so it should work):

Your post is off-topic for this forum, which concerns only software installed from the SME server install CD.

You will be better off IMO asking your question in a php programming forum.

Offline Maniac

  • *
  • 15
  • +0/-0
Re: php mail function does not work
« Reply #2 on: August 19, 2009, 02:04:17 PM »
yes, I know that, but I wanted to raise a topic to the server (esp. the included php-server), not to the php script, which should be fine.
The fact is that there is no error message coming from the php-server, so I can't get the problem. Other php-errors are indicated correctly.
What I think is that there is a setting or a security fact that is blocking the mail function. Maybe someone has an idea? It should be possible to create a simple contact formular shouldn't it? I would be very grateful  :smile:

Offline chris burnat

  • *****
  • 1,135
  • +2/-0
    • http://www.burnat.com
Re: php mail function does not work
« Reply #3 on: August 31, 2009, 11:02:54 AM »
Moving to General discussion, as requested.
- chris
If it does not work out of the box, please fill in a Bug Report @ Bugzilla (http://bugs.contribs.org)  - check: http://wiki.contribs.org/Bugzilla_Help .  Thanks.