Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9

Thread: E-Mail problem

  1. #1
    New Coder
    Join Date
    Oct 2012
    Location
    Basement
    Posts
    88
    Thanks
    9
    Thanked 0 Times in 0 Posts

    E-Mail problem

    Hey there, I would like people to send me an email via my website but whenever I click on submit it opens up my email.. Is there a way I can make it so that when someone presses 'aanmelden' that it sends the email directly to my mail?

    I got this so far but it opens up the persons email program:

    Code:
    <p class = "cheader">Aanmelden nieuwsbrief<hr /> </p>
            	<table class="nieuwsbrief">
                	<tbody><tr>
                    <form method = "post" action = "mailto:info@bioscoop-filmpje.allalla.com">
                    	<td class="onderwerpen">Aanhef: *</td>
                        <td>
                        	 Dhr. <input type="radio" value="Dhr" name="aanhef" required>&nbsp;
                             Mevr. <input type="radio" value="Mevr" name="aanhef">
                        </td>
                    </tr>
                	<tr>
                    	<td class="onderwerpen">Voornaam: *</td>
                        <td><input type="text" class="inputContact" name="voornaam" placeholder = "Voornaam" required></td>
                    </tr>
                    <tr>
                    	<td class="onderwerpen">Achternaam: *</td>
                        <td><input type="text" class="inputContact" name="achternaam" placeholder = "Achternaam" required></td>
                    </tr>
                    <tr>
                    	<td class="onderwerpen">E-mailadres: *</td>
                        <td><input type="email" class = "inputContact" name="usremail" placeholder = "example@example.com" required><br></td>
                    </tr>
                </tbody></table>
                
                <table class="nieuwsbrief">
                    <tbody><tr>
                    	<td class="onderwerpen">Adres:</td>
                        <td><input type="text" class="inputContact" name="adres" placeholder = "Straat + Nummer"></td>
                    </tr>
                    <tr>
                    	<td class="onderwerpen">Postcode en plaats:</td>
                        <td>
                        	<input type="text" maxlength="6" id="inputPostcode" name="postcode" placeholder = "1234AJ">
                        	<input type="text" id="inputPlaats" name="plaats" placeholder = "Plaatsnaam">
                        </td>
                    </tr>
                    <tr>
                    	<td class="onderwerpen">Telefoonnummer:</td>
                        <td><input type="tel" maxlength="10" class="inputContact" name="telefoon" placeholder = "Telefoonnummer"></td>
                    </tr>
                    <tr>
                    	<td class="onderwerpen">Opmerking:</td>
                    	<td><textarea id="inputMessage" name="message"></textarea></td>
                    </tr>
                    <tr>
                    	<td class="onderwerpen"><b>* zijn verplicht</b></td>
                    	<td><input type="submit" name="submit" value = "Aanmelden"></td>
                    </tr>
                </tbody></table>

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,313
    Thanks
    203
    Thanked 2,564 Times in 2,542 Posts
    The trouble with using this long-obsolete method (mailto) to send form results is its unpredictability. The method it is highly dependent on the browser in use
    and the email client in use (some people have only Yahoo, Gmail or Hotmail). In particular, your visitor must have Outlook or Outlook Express or Windows Live Mail as the default client for this to work correctly. Even if your visitor is using Internet Explorer, but the default mail client is different (e.g. Eudora or Thunderbird), your mailto form will not work. With all of the browser troubles, you're likely to lose about half of your users' messages. Most of the email clients that can successfully send a mail will prompt the user with a somewhat threatening security dialog prior to sending - this can scare many users from continuing. Other users will not wish to reveal their email address. Also, what about people with Javascript disabled?

    In addition, if you place an unobfuscated email address in your webpage, the bots will quickly find it and inundate you in spam.

    Modern browsers no longer accept mailto: as a form action - they simply open the email program (if any) and ignore the form. If you are going to use a form then use a server-side CGI formmail script as the action - there are several good free ones out there.

    For a simple PHP form feedback script see:- http://www.thesitewizard.com/archive/feedbackphp.shtml
    or http://www.felgall.com/php2.htm


    All advice is supplied packaged by intellectual weight, and not by volume. Contents may settle slightly in transit.

    All the code given in this post has been tested and is intended to address the question asked.
    Unless stated otherwise it is not just a demonstration.

  • #3
    New Coder
    Join Date
    Oct 2012
    Location
    Basement
    Posts
    88
    Thanks
    9
    Thanked 0 Times in 0 Posts
    Thanks philip i will see what i can do.. it's not a REAL site for public use.. just for a group of lets say 50 people.

  • #4
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,313
    Thanks
    203
    Thanked 2,564 Times in 2,542 Posts
    Quote Originally Posted by optimizer123 View Post
    Thanks philip i will see what i can do.. it's not a REAL site for public use.. just for a group of lets say 50 people.
    Mailto: will still not work reliably for 50 or 50000.

    All the code given in this post has been tested and is intended to address the question asked.
    Unless stated otherwise it is not just a demonstration.

  • #5
    New Coder
    Join Date
    Oct 2012
    Location
    Basement
    Posts
    88
    Thanks
    9
    Thanked 0 Times in 0 Posts
    Hey philip. After what i did i click on submit and it opens sendmail.php.. but its blanco.. nothing pops up or whatever.. while i got this in my sendmail.php:

    Code:
    <?php
      $email = $_REQUEST['email'] ;
      $message = $_REQUEST['message'] ;
    
      mail( "Censored@hotmail.com", "Feedback Form Results",
        $message, "From: $email" );
      header( "Location: http://www.example.com/thankyou.html" );
    ?>
    Why isnt it working?
    Does it only work when your site is online?

  • #6
    New Coder
    Join Date
    Oct 2012
    Location
    Basement
    Posts
    88
    Thanks
    9
    Thanked 0 Times in 0 Posts
    This is my Html in <body>;

    Code:
    <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" />

  • #7
    Senior Coder
    Join Date
    Apr 2011
    Location
    London, England
    Posts
    2,120
    Thanks
    15
    Thanked 354 Times in 353 Posts
    You should end the additional headers with a line break (\r\n):

    PHP Code:
    mail"Censored@hotmail.com""Feedback Form Results",
        
    $message"From: $email\r\n" ); 
    You should also, as I recall, remove such line-breaks from the $message using str_replace().

    And, of course, you should sanitise 'email' and 'message' before inserting them into the mail() function.

    If testing this locally you also need a mail-server to process the email.

    Email injection
    Last edited by AndrewGSW; 11-28-2012 at 09:24 PM.
    "I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
    Validate your HTML and CSS

  • #8
    Senior Coder
    Join Date
    Apr 2011
    Location
    London, England
    Posts
    2,120
    Thanks
    15
    Thanked 354 Times in 353 Posts
    If you are on Windows you can use this simple tool to test sending emails.

    i click on submit and it opens sendmail.php
    I'm guessing you have just created a PHP file.. You need a web server to work with (test) PHP, such as WAMP (or LAMP) or XAMPP - these include the Apache web-server.
    Last edited by AndrewGSW; 11-28-2012 at 09:31 PM.
    "I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
    Validate your HTML and CSS

  • #9
    New Coder
    Join Date
    Oct 2012
    Location
    Basement
    Posts
    88
    Thanks
    9
    Thanked 0 Times in 0 Posts
    ty =)


  •  

    Posting Permissions

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