Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MailTo and the body field-how many characters can it hold?

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Greetings.
I'm attempting to generate an email using about twenty different variables. Currently I populate all the good stuff - 'to', 'cc', 'subject', and 'body' with individual var's. But I'm filling the body with, at time, are 100's of characters. This little program runs fine when the body contains less than 300 characters, but when it's over, I get an error (from MS) saying my email client is not installed correctly and when using LotusNotes, it doesn't even make it to the opening the email client.

So, my main question is, Is there a limit to the amount of characters held in the body field? And if so, how do I get around it.

Thanks.
 
I'm not sure whether the problem here is the max allowed number of characters in the body field so much as the max allowed characters in the mailto link itself. Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
I have just reached the same problem. I was trying to use mailto to send a URL within the body. With IE, at a certain length, clicking mailto returns the helpful(?) message:

[tt]Could not perform this operation because the default mail client is not properly installed[/tt]

Oh joy :-( Neil
 
BobinPDX,

Here's the way I got 'round the limitations. I had a bunch of variables I wanted people to send. In this case, it was filling out a form and having it e-mail the data to me.

I found this solution somewhere and maybe it'll help you. Note that it requires two forms and one small external .js file...

First, this document:

Code:
<!DOCTYPE html 
     PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot;
     &quot;[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;>[/URL]

<html xmlns=&quot;[URL unfurl="true"]http://www.w3.org/1999/xhtml&quot;[/URL] xml:lang=&quot;en&quot; lang=&quot;en&quot;>
  <head>
    <meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;></meta>
    <title>Send Out The Data</title>
    <link rel=&quot;stylesheet&quot; href=&quot;Style.css&quot; type=&quot;text/css&quot;></link>
    <script src=&quot;sample.js&quot; type=&quot;text/javascript&quot;></script>
  </head>
  <body>
  <h3>Submissions Form</h3>
  <form name=&quot;SubmissionForm&quot; action=&quot;mailto:HungryMan@DonnerParty.com&quot; enctype=&quot;multipart/form-data&quot;>
    <table class=&quot;Fatscope&quot;>
      <tr>
        <td class=&quot;DescriptorCell&quot;>Function Name:</td>
        <td class=&quot;ContentCell&quot;><input type=&quot;text&quot; size=&quot;100&quot; id=&quot;FunctionName&quot;></input></td>
      </tr>
      <tr>
        <td class=&quot;DescriptorCell&quot;>Module which contains Function:</td>
        <td class=&quot;ContentCell&quot;><input type=&quot;text&quot; size=&quot;100&quot; id=&quot;ModuleName&quot;></input></td>
      </tr>
      <tr>
        <td class=&quot;DescriptorCell&quot;>Module Location:</td>
        <td class=&quot;ContentCell&quot;><input type=&quot;text&quot; size=&quot;100&quot; id=&quot;ModuleLocation&quot;></input></td>
      </tr>
      <tr>
        <td class=&quot;DescriptorCell&quot;>Function Description:</td>
        <td class=&quot;ContentCell&quot;><textarea cols=&quot;75&quot; rows=&quot;5&quot; id=&quot;FunctionDescription&quot;></textarea></td>
      </tr>
      <tr>
        <td class=&quot;DescriptorCell&quot;>Function Parameters:</td>
        <td class=&quot;ContentCell&quot;><input type=&quot;text&quot; size=&quot;100&quot; id=&quot;FunctionParameters&quot;></input></td>
      </tr>
      <tr>
        <td class=&quot;DescriptorCell&quot;>Function Example Call:</td>
        <td class=&quot;ContentCell&quot;><input type=&quot;text&quot; size=&quot;100&quot; id=&quot;FunctionExample&quot;></input></td>
      </tr>
      <tr>
        <td class=&quot;DescriptorCell&quot;>Programmer Name:</td>
        <td class=&quot;ContentCell&quot;><input type=&quot;text&quot; size=&quot;100&quot; id=&quot;ProgrammerName&quot;></input></td>
      </tr>
    </table>
    <p class=&quot;CenteredContent&quot;><input type=&quot;reset&quot; value=&quot;Clear All Entries&quot; class=&quot;PDButton&quot;></input></p>
  </form>

  <form name=&quot;ProxyForm&quot; enctype=&quot;text/plain&quot; method=&quot;post&quot; action =&quot;mailto:HungryMan@DonnerParty.com?subject=Reuseable Code Library Submission&quot; onsubmit=&quot;update_message_body();return true;&quot;>
    <p class=&quot;CenteredContent&quot;><input type=&quot;submit&quot; value=&quot;Submit New Function&quot; class=&quot;PDButton&quot;></input></p>
    <input type=&quot;hidden&quot; id=&quot;MessageBody&quot; name=&quot;MessageBody&quot;></input>
  </form>
  </body>
</html>

Obviously, this uses an external stylesheet called &quot;Style.css&quot;, which you can tell from the class calls, but don't let that bother you -- it's just things like background colors, etc. Also, it should be obvious that I trimmed away a bunch of content that is proprietary, but again, it shouldn't be a problem.

Here's the external JavaScript file, which should be saved as &quot;sample.js&quot;:

Code:
    function update_message_body()
      // This function composes an e-mail message using the contents of 
      // another form on the same page.
      {
        var FunctionName = document.SubmissionForm.FunctionName.value;
        var ModuleName = document.SubmissionForm.ModuleName.value;
        var ModuleLocation = document.SubmissionForm.ModuleLocation.value;
        var FunctionDescription = document.SubmissionForm.FunctionDescription.value;
        var FunctionParameters = document.SubmissionForm.FunctionParameters.value;
        var FunctionExample = document.SubmissionForm.FunctionExample.value;
        var ProgrammerName = document.SubmissionForm.ProgrammerName.value;
        var CurrentDate = new Date();

        document.ProxyForm.MessageBody.value = &quot;\n\n&quot; + &quot;-= Start of Message =-&quot; + &quot;\n\n&quot;
                                                + &quot;Reuseable Code Library Submission&quot; + &quot;\n\n&quot;
                                                + &quot;Time received: &quot; + CurrentDate + &quot;\n\n&quot;
                                                + &quot;Function Name: &quot; + FunctionName + &quot;\n\n&quot;
                                                + &quot;Module Name: &quot; + ModuleName + &quot;\n\n&quot;
                                                + &quot;Module Location: &quot; + ModuleLocation + &quot;\n\n&quot;
                                                + &quot;Function Description: &quot; + FunctionDescription + &quot;\n\n&quot;
                                                + &quot;Function Parameters: &quot; + FunctionParameters + &quot;\n\n&quot;
                                                + &quot;Function Example Call: &quot; + FunctionExample + &quot;\n\n&quot;
                                                + &quot;Submitted by: &quot; + ProgrammerName + &quot;\n\n&quot; + &quot;-= End of Message =-&quot;;
        return true;
      }

Sends all that junk in e-mail, neat as you please.

The tiniest caveat is that the browser -- depending upon your security settings -- pops up a warning that you are about to send e-mail via the web page.

I have not tested this in anything other than IE, as this client insisted on using only IE on all their machines.

Good luck!

Edward &quot;Do not read this sentence.&quot;
 
BobInPDX

EdwardMartinIII has a great script. I have not tested it myself but it looks great. It's just what I would need to send form data to an email address and to a database simultaneously.

However, I think it's going to a lot of un-neccesary trouble if all you want to do is send form data to an email address. To put all the data that a user has entered in a form into an email, just use the METHOD=&quot;post&quot; attribute of the form tag and make sure to use enctype=&quot;text/plain&quot;.

i.e. <form action=&quot;mailto:mailbox@someserver.com?subject=ACME Form Return&quot; METHOD=&quot;post&quot; enctype=&quot;text/plain&quot; name=&quot;FormName&quot; onsubmit=&quot;return CheckForm()&quot; >

This is basic HTML, nothing fancy, so I'm sure it will work on all browsers.

Note: CheckForm() is a JavaScript function that checks that some mandatory fields have been filled in.

 
Sorry talking about &quot;mailto tag&quot;, do you know if is possible to send a variable instead of the email address directly???

This is because, I need a form where users must type someone email address and the value of the input text should send mailto:varEmail.

Or actually there is no way to do this througth the mailto tag????

Thanks in advance...

Liliana Meneses
 
Liliana,

You can take the email address from a field in the form. It does require a little javascript - but nothing too fancy. Try this javascript:

Code:
<script type=&quot;text/javascript&quot;>
function setEmailAddress()
{
  var myFormObj = document.myForm;
  var returnValue = false;
  if (myFormObj.emailAddress.value != &quot;&quot;)
  {
    myFormObj.action = &quot;mailto:&quot;;
    myFormObj.action += myFormObj.emailAddress.value;
    myFormObj.action += &quot;?subject=&quot;;
    myFormObj.action += &quot;This is a test email&quot;;
    returnValue = true;
  }
  return (returnValue);
}
</script>

And this HTML (on the page itself):

Code:
<form name=&quot;myForm&quot; action=&quot;&quot; method=&quot;post&quot; enctype=&quot;text/plain&quot; onsubmit=&quot;return setEmailAddress()&quot;>
<input type=&quot;text&quot; name=&quot;emailAddress&quot; />
<input type=&quot;submit&quot; value=&quot;Send Email&quot; />
</form>

Hope this is of value to you.

Jeff
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top