Results 1 to 9 of 9

Thread: send email via html

  1. #1
    Join Date
    Jul 2009
    Location
    Binus University
    Posts
    472
    Thanks
    78
    Thanked 21 Times in 21 Posts

    Default send email via html

    i'm making a contact form here,

    Question:
    How to get message from client / user and send it to my email address.



    When user click send button the user email address and message will be send to my acount.

    Thx for all of your help...

  2. #2
    Join Date
    Nov 2008
    Posts
    58
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Default

    You need to have a server side script (written in PHP for example).

    The following tutorials might help:
    How to make a web form

    Email Form 'HowTo's

    You can use a 'ready-made' form mail script as well.

  3. #3
    Join Date
    Jul 2009
    Location
    Binus University
    Posts
    472
    Thanks
    78
    Thanked 21 Times in 21 Posts

    Default

    thx for reply. That really help..

    But is there another suggestion?

    What i really need is just the code that get the value from the textfield and textarea and send it directly to my email account.

  4. #4
    Join Date
    Apr 2009
    Location
    Cognac, France
    Posts
    400
    Thanks
    2
    Thanked 57 Times in 57 Posts

    Default

    You definitely need to use a server side script like PHP.

    These scripts can be very simple, I've posted examples of this in this forum before.

    Here is a simple PHP script to create an email from data collected in a form:

    PHP Code:
        <?php 
        
    //variables 
         
        //form contents 
        
    $txtMessage=$_POST['message']; 
        
    $txtMail=$_POST['email']; 
        
    $txtMessage str_replace(array("\n","\r"),'',$txtMessage);  
        
    $txtEmail str_replace(array("\n","\r"),'',$txtMail); 
        
    $Myemail="your email address here"


    $message ="Message :\t$txtMessage\n 
            \n" 
    $subject "Message from - ".$txtEmail;  
    $mailheaders "From: $txtEmail <> \n";  
    $mailheaders .= "Reply-To: $txtEmail\n\n";  

        
    //send mail 
        
    mail($Myemail$subject$message ,  $mailheaders); 
        
    ?>
    The variables 'email' and 'message' are the names of input fields in your form.

    Save the above PHP to a php file, eg process.php, and in your <form> tag you add, method="POST" action="process.php".

    This is a simple example of creating an email, you can add more fields from the input form quite easily.

  5. The Following User Says Thank You to forum_amnesiac For This Useful Post:

    davelf (09-10-2009)

  6. #5
    Join Date
    Jul 2009
    Location
    Binus University
    Posts
    472
    Thanks
    78
    Thanked 21 Times in 21 Posts

    Default

    hi, forum_amnesiac thx a lot for your help. I'll this at my contact form.

    One last question:

    is that possible to use javascript to make my contact form worked?

    because i don't have any experience in PHP. So if there's javascript code to solve this problem, share with me please...

    but one's again thx for forum_amnesiac and prasanthmj

  7. #6
    Join Date
    Feb 2009
    Posts
    303
    Thanks
    18
    Thanked 36 Times in 36 Posts

    Default

    Nope - JavScript won't work, it's Client-Side, you need Server-Side.

    Most modern hosting providers support PHP, if they don't, then you should really consider switching to a better host....

    Cheers,
    X96
    Alex Blackie, X96 Design
    My Website
    I specialize in: HTML5, CSS3, PHP, Ruby on Rails, MySQL, MongoDB, Linux Server Administration

  8. The Following User Says Thank You to X96 Web Design For This Useful Post:

    davelf (09-10-2009)

  9. #7
    Join Date
    Jul 2009
    Location
    Binus University
    Posts
    472
    Thanks
    78
    Thanked 21 Times in 21 Posts

    Default

    oow, ok thx. Just want extra information.

  10. #8
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    There are also things called "Remotely Hosted Scripts" which is just what you were looking for in your original post and only require a little bit of code that you have to place in your HTML page. Do a Google search for "Remote Hosted Contact Form".

    Hope this helps.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

  11. The Following User Says Thank You to thetestingsite For This Useful Post:

    davelf (09-10-2009)

  12. #9
    Join Date
    Jul 2009
    Location
    Binus University
    Posts
    472
    Thanks
    78
    Thanked 21 Times in 21 Posts

    Default

    thx for all the reply, i've change my mind and follow all of your suggestion, i will use the php script to handle this contact form.

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
  •