SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Addict einSTein's Avatar
    Join Date
    Aug 2006
    Posts
    276
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    want to send mail within my site (was "some body please help")

    i want to send mail within my site
    so this is form+function
    it gives error

    Code PHP:
     
    <html>

    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <title>To</title>
    </head>

    <body>
    <form name="frmsendmail" method="post" action="" onSubmit="return ValidationForm()">
    <table width="100%" border="0">
    <tr>
    <td width="33%" align="right" class="text">To :
    <td width="67%"><input name="txtEmailto2" type="text" class="input" id="txtEmailto22" size="30" maxlength="100">
    </tr>
    <tr>
    <td align="right" class="text">From :
    <td><input name="txtEmailfrm2" type="text" class="input" id="txtEmailfrm22" size="30" maxlength="100">
    </tr>
    <tr>
    <td align="right" class="text">Subject :
    <td><input name="txtSub2" type="text" class="input" id="txtSub22" size="30" maxlength="100">
    </tr>
    <tr>
    <td align="right" class="text">Mesage(body) :
    <td><textarea name="txtMsg" cols="50" rows="10" class="input" id="textarea"></textarea>
    </tr>
    <tr>
    <td align="right"><input name="hidSubmit" type="hidden" id="hidSubmit" value="true">
    <input name="Submit" type="submit" class="input" value="Send">
    <td><input name="Submit2" type="reset" class="input" value="Reset">
    </tr>
    </table>
    </form>
    </body>

    </html>


    <?php

    //Check whether the submission is made
    if(isset($hidSubmit)){

    //Declarate the necessary variables
    $mail_to=$txtEmailto;
    $mail_from=$txtEmailfrm;
    $mail_sub=$txtSub;
    $mail_mesg=$txtMsg;

    //Check for success/failure of delivery
    if(mail($mail_to,$mail_sub,$mail_mesg,"From:$mail_from/r/nReply-to:$mail_from"))
    echo "<span class='textred'>E-mail has been sent successfully from $mail_sub to $mail_to</span>";
    else
    echo "<span class='textred'>Failed to send the E-mail from $mail_sub to $mail_to</span>";
    }
    ?>

    error: Method Not Allowed
    The requested method POST is not allowed for the URL /try/send.html.

  2. #2
    Sell crazy someplace else markl999's Avatar
    Join Date
    Aug 2003
    Location
    Manchester, UK
    Posts
    4,007
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This needs to be a .php page, you can't POST to .html files (by default), so try renaming it to send.php

  3. #3
    SitePoint Addict einSTein's Avatar
    Join Date
    Aug 2006
    Posts
    276
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yes now it gives no error, but i've got no mail... Does it take time?

  4. #4
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,347
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    possibly this is the reason?
    Code:
    action=""
    that form might submit but it won't go noplace
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  5. #5
    SitePoint Evangelist
    Join Date
    Sep 2004
    Location
    Oregon
    Posts
    445
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Depending on the server setup, you might need to define the variable.

    PHP Code:
    if(isset($_POST["hidSubmit"])) 


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •