...

View Full Version : E-Mail problem



optimizer123
11-28-2012, 07:33 PM
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:


<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>

Philip M
11-28-2012, 07:43 PM
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.

optimizer123
11-28-2012, 08:23 PM
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.

Philip M
11-28-2012, 08:33 PM
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. :(

optimizer123
11-28-2012, 08:49 PM
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:


<?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?

optimizer123
11-28-2012, 08:52 PM
This is my Html in <body>;


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

AndrewGSW
11-28-2012, 09:16 PM
You should end the additional headers with a line break (\r\n):


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 (http://www.damonkohler.com/2008/12/email-injection.html)

AndrewGSW
11-28-2012, 09:23 PM
If you are on Windows you can use this simple tool (http://www.toolheap.com/test-mail-server-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.

optimizer123
11-28-2012, 09:47 PM
ty =)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum