Jump to content

Trouble with the email button code


mp3d

Recommended Posts

I did the email code with HTML, but I have a few problems:1. The button doesn't email me the content the people would have selected above the button. I filled in my email in the right part of the code.2. The "Comment" box, I want, to be as big up/downwards as a standard textarea. How do I make that possible?I already know JavaScript, and don't mind if you need to use it to make this work. Here is the code I used: <html><body><p>This example shows how to send an e-mail from a form:</p><form action="mailto:someone@example.com" method="post" enctype="text/plain">Name:<br /><input type="text" name="name" size="20" /><br />Email:<br /><input type="text" name="email" size="20" /><br />Comment:<br /><input type="text" name="comment" size="40" /><br /><br /><input type="submit" value="Send" /><input type="reset" value="Reset" /></form></body></html>And here is the output:

<html><body><p>This example shows how to send an e-mail from a form:</p><form action="mailto:someone@example.com" method="post" enctype="text/plain">Name:<br /><input type="text" name="name" size="20" /><br />Email:<br /><input type="text" name="email" size="20" /><br />Comment:<br /><input type="text" name="comment" size="40" /><br /><br /><input type="submit" value="Send" /><input type="reset" value="Reset" /></form></body></html>

Look at this output and see where I put my email in colored letters:

var str="<html><body><p>This example shows how to send an e-mail from a form:</p><form action="mailto:someone@example.com" method="post" enctype="text/plain">Name:<br /><input type="text" name="name" size="20" /><br />Email:<br /><input type="text" name="email" size="20" /><br />Comment:<br /><input type="text" name="comment" size="40" /><br /><br /><input type="submit" value="Send" /><input type="reset" value="Reset" /></form></body></html>";var patt1=/someone@example/g;

Also guys, I am looking for a good place to start learning Java itself...DANG this forum doesn't allow codes.

Link to comment
Share on other sites

You should really consider NOT using the mailto protocol. Many users do not configure their browser to open any email program, and the default setting may open an email program that they do not use. Also, browsers are not consistent in the way they pass information to an email program.You would do much better to send form data to an email script on your server. There are dozens of tried-and-true scripts available for free that are written in Perl, PHP, VBScript, and so on. Generally, they require very little configuration to work, so even non-programmers can get them running in a few minutes.Google something like PHP mail script, depending on your language

Link to comment
Share on other sites

You should really consider NOT using the mailto protocol. Many users do not configure their browser to open any email program, and the default setting may open an email program that they do not use. Also, browsers are not consistent in the way they pass information to an email program.You would do much better to send form data to an email script on your server. There are dozens of tried-and-true scripts available for free that are written in Perl, PHP, VBScript, and so on. Generally, they require very little configuration to work, so even non-programmers can get them running in a few minutes.Google something like PHP mail script, depending on your language
The PHP version never used to work anyway. Maybe wrong code...
Link to comment
Share on other sites

THE version? Like I said, there are dozens, more likely hundreds, floating out there. Some are based on the PHP mail() function. Because some free hosts disable that function, other scripts have been written that do their own SMTP.

Link to comment
Share on other sites

The PHP version never used to work anyway. Maybe wrong code...
Are you using a hosting package? If so, check your control panel to see if there is a mail application. I recently wanted to create a RESERVATION form on my website and struggled with how to mail it until I checked my hosting services.Mine has a CGI email that works very well. It even has rudimentary validation and mandatory field checking.The other nice thing is that it offers me the option "on success only" to go to a thank you HTML page where I can say whatever I want like "thanks for writing and I'll get back to you in 24 hours..........."Sometimes the solution is close at hand.
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...