Pre-populated e-mail?

liunx

Guest
Is there a way to pre-populate en e-mail link easily?<br />
<br />
I want to have a link on a site that says 'e-mail us here to join the mailing list'.<br />
<br />
I can obviously make a mail link which will bring up the user's e-mail app. and pre-populate the 'To:' field...but is it possible to make it pre-populate the e-mail with a subject and some text in the e-mail saying 'Please add me to the mailing list'?<br />
<br />
If this isn't possible, I guess I would need to use a form, but is that complicated??<br />
<br />
Thanks<!--content-->Thanks Dave - that's excellent! <br />
<br />
Is there a way to pre-populate the body of the e-mail too? Like ?text=hello or is it only subject that works?<br />
<br />
Also, when you say people with browser based e-mail won't be able to use this, do you mean it will just open the e-mail link without the words? or will it screw up and look strange? or not work at all etc..?<br />
<br />
Thanks a lot<!--content-->What the link does is that it open up your email client and populate the form with destination email and the subject. Since yahoomail is not a pop email and it do not use email client such as outlook express or eudora, the link serves no purpose to them.<!--content-->To add to Daves reply you can populate the body of the email like this:<br />
<a href=http://www.webdeveloper.com/forum/archive/index.php/"mailto:[email protected]?subject=Please add me to the mailing list&body=some text">e-mail us here to join the mailing list</a><br />
<br />
Like he said though a Server Side solution would be better because the above link will not work if they do not have their email client set up correctly or not at all. If you don't have access to Server Side languages with your host then you might try using a service such as <!-- m --><a class="postlink" href="http://www.bravenet.com/">http://www.bravenet.com/</a><!-- m --> .<!--content--><a href=http://www.webdeveloper.com/forum/archive/index.php/"mailto:[email protected]?subject=Please add me to the mailing list&body=some text">e-mail us here to join the mailing list</a> <br />
<br />
I tried this and it appears that Outlook has issues with spaces in the mailto string. It works fine if both the subject and body of the mailto string are only one word. Any thoughts?<br />
<br />
Thanks,<br />
Tom<!--content-->Originally posted by TomWeinstock <br />
Any thoughts? Use a server-side script to handle a form. It's the only method that works.<!--content-->Thanks Dave. The '%20' worked great. This is for our Intranet site for users who have questions on financial info. I'm thinking of having them click this link when they have a question and the subject and part of the e-mail body would be information about the report the user is viewing. <br />
<br />
I work mostly in the Unix/Informix world and have only recently began to create Informix programs that create HTML reports for individual attorneys. This is my solution to creating a "paper-less" reporting system. We are currently using Seagate Info (Crystal Reports) to do this, but we end up killing a lot of trees that way as the reports get printed out and distributed manually to the attorneys. The reason I went into this whole dissertation (and thanks for reading this far) is that I am hoping that someone can tell me any cons to taking this approach, assuming, of course, that this road has been traveled by someone in this forum.<br />
<br />
Thanks again.<br />
<br />
Tom<!--content-->Yes, the rules concerning a public space do not apply to an intranet. This does not mean, however, that no rules apply. I note that Mr. Weinstock is located in Milwaukee and as such his site is subject to the requirements of the Americans with Disabilities Act. If the intranet is a part of employment and there are 15 or more employees (Title I) or if this is a part of a commercial enterprise (Title III) then he'll need to be ready to make available a screen reader that understands the "mailto:" URL scheme with the FORM "action".<!--content-->This is some code that I've been sitting on for a while I developed for an intranet website at my company.<br />
<br />
The first example shows you how you can hard-code information into drop-down menus and have an email automatically generated with a To: and Subject: filled in with the user's selections. For the body of the message, that can be hard-coded also if you apply the techniques already used in the example to expand on its functionality. <br />
<br />
In the second example, it shows you how the code can be modified to allow complete user entry of To: and Subject and the body of the message. As an added bonus, it demonstrates how you can take input from different <input type="text"> sources and include them into the body of the message in a multi-line format. Took me a while to figure that one out, but eventually was able. This can also be modified to accept inputs from other sources, such as multiple drop-down menus or checkboxes that will then output to the email message body.<br />
<br />
Hope this code helps.<br />
<br />
Geuis<br />
<br />
Example 1:<br />
<html><br />
<title>Javascript Generated Email</title><br />
<br />
<script language="javascript"><br />
<br />
<!-- Author: Geuis Teses 4/2003<br />
<!-- This code is usable by anyone who wants it, <br />
<!-- just include these comments in the code in the document.<br />
<br />
function email() <br />
{<br />
var varTo = document.forms[0].mailTo.options[document.forms[0].mailTo.selectedIndex].value<br />
var subject = document.forms[0].mailSubject.options[document.forms[0].mailSubject.selectedIndex].value<br />
<br />
var body = document.forms[0].emailBody.value<br />
<br />
<br />
<!--body = body + "%0a%0a" + "Test line 1";<br />
<br />
if (subject != "" && varTo != "")<br />
{<br />
window.location = "MAILTO:" + varTo +"?subject=" + subject + "&body=" + body;<br />
<br />
return true;<br />
}<br />
else<br />
{<br />
alert("You must select someone to send the message to and a subject!")<br />
}<br />
<br />
}<br />
</script><br />
<br />
<body><br />
<h2>This is an example of coding different options into drop-down menus and having Javascript auto-generate an email with a program like Outlook.</h2><br />
<br />
<form><br />
<select name="mailTo"><br />
<option selected value="">Send mail to:<br />
<option value="Bob">Bob<br />
<option value="Joe">Joe<br />
<option value="Henry">Henry<br />
<option value="Superman">Superman<br />
</select><br />
<br><br />
<select name="mailSubject"> <br />
<option selected value="">Subject:<br />
<option value="What's up?">What's up?<br />
<option value="Help!!">Help!!<br />
<option value="I'm an 18 year old lonely, horny girl">I'm an 18 year old lonely, horny girl<br />
</select> <br />
<br><br />
<textarea name="emailBody" value="" rows="20" cols="55" wrap="virtual"></textarea><br />
<br />
<br><br />
<input type="button" name="sendBut" value="Create Email" onclick="email()"><br />
<br />
</form><br />
</body><br />
</html><br />
<br />
**********************************************<br />
<br />
Example 2<br />
<html><br />
<title>Javascript Generated Email</title><br />
<br />
<script language="javascript"><br />
<br />
<!-- Author: Geuis Teses 4/2003<br />
<!-- This code is usable by anyone who wants it, <br />
<!-- just include these comments in the code in the document.<br />
<br />
function email() <br />
{<br />
var varTo = document.forms[0].mailTo.value<br />
var subject = document.forms[0].mailSubject.value<br />
<br />
var body = document.forms[0].body1.value + "%0a" + document.forms[0].body2.value + "%0a" + document.forms[0].body3.value + "%0a"<br />
<br />
<br />
<!--body = body + "%0a%0a" + "Test line 1";<br />
<br />
if (subject != "" && varTo != "")<br />
{<br />
window.location = "MAILTO:" + varTo +"?subject=" + subject + "&body=" + body;<br />
<br />
return true;<br />
}<br />
else<br />
{<br />
alert("You must select someone to send the message to and a subject!")<br />
}<br />
<br />
}<br />
</script><br />
<br />
<body><br />
<h2>This is an example of coding different options into separate text boxes and having Javascript auto-generate an email with a program like Outlook.</h2><br />
<br />
<form><br />
To:<br />
<input type="text" name="mailTo" value=""><br />
<br><br />
Subject:<br />
<input type="text" name="mailSubject" value=""><br />
<br><br />
<br />
<input type="text" name="body1" value=""><br />
<br />
<br><br />
<input type="text" name="body2" value=""><br />
<br />
<br><br />
<input type="text" name="body3" value=""><br />
<br />
<br><br />
<input type="button" name="sendBut" value="Create Email" onclick="email()"><br />
<br />
</form><br />
</body><br />
</html><!--content-->Thanks for the feedback guys...and Dave for the laugh.<br />
<br />
Tom<br />
<br />
P.S. Charles...I'll get right on that! ;)<!--content-->
 
Back
Top