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!

max size on body field in mailto (within a href)

Status
Not open for further replies.

wrbodine

Programmer
Aug 24, 2000
302
US
Hi,

I'm using the mailto command within an <a href=&quot; tag, and when the mail message comes up in Outlook its cutting short the body section (it only displays 179 characters, around half of what was on the page). Is there a limit to how much can be in the body part of mailto? And is there anything that can be done about this?

Thanks,
Ray
 
What is the &quot;Mailto&quot; command within an <a href= tag? I'm familiar with using &quot;mailto&quot; as a protocol (like http) to specifiy a recipient address for a link that launch the user's email client.

If there is a way to specify the body of that message, I'd love hear about it. Please let me know if I'm completely missing the point here?
 
Ray,


If your message is being cut off it could be due to a particular character in the message string. Possibly a quote or double quote.

Do a test string with all letter characters, no spaces.

HTH
 
For the record:
Code:
<a href=&quot;mailto:target@yoursite.com?subject=Hi there&body=some stuff and more stuff, etc&quot;>Mail</a>

After testing for quotes you might want to try to use the Server.URLEncode to replace unwanted characters with url ok encoding.
-Tarwn ________________________________________________________________________________
Want to get great answers to your Tek-Tips questions? Have a look at faq333-2924
 
lottastuff - I guess you saw Tarwn's post; that's how you add a subject and body to the e-mail. You can also check out this link:
HTH and Tarwn, thanks for your ideas. I don't think its an unwanted character that's cutting things short, because when I add newline characters %0d (see above link), each time I add one it shortens the message by a few characters, so it seems to be stopping at a certain length.

Hopefully this won't confuse things: I'm actually using this href in an .xsl page that is rendering html. So my code looks like this:

<tr>
<td colspan=&quot;4&quot; align=&quot;center>
<xsl:element name=&quot;a&quot;>
<xsl:attribute name=&quot;href&quot;>
mailto:&subject=Test&body=
Referral Date: <xsl:value-of select=&quot;@ReferralDate&quot;/>%0d
Employee Name: <xsl:value-of select=&quot;@EmployeeName&quot;/>%0d
Department: <xsl:value-of select=&quot;@Department&quot;/>%0d
Employee Number: <xsl:value-of select=&quot;@EmployeeNumber&quot;/>%0d
Telephone: <xsl:value-of select=&quot;@Telephone&quot;/>%0d
First Name: <xsl:value-of select=&quot;@FirstName&quot;/>%0d
Last Name: <xsl:value-of select=&quot;@LastName&quot;/>%0d
Address: <xsl:value-of select=&quot;@Address&quot;/>
City: <xsl:value-of select=&quot;@City&quot;/>
State: <xsl:value-of select=&quot;@State&quot;/>
Zip Code: <xsl:value-of select=&quot;@ZipCode&quot;/>
Business Phone: <xsl:value-of select=&quot;@BusinessPhone&quot;/>
Home Phone: <xsl:value-of select=&quot;@HomePhone&quot;/>
Best Time To Call: <xsl:value-of select=&quot;@BestTimeToCall&quot;/>
Estimated Asset Value: <xsl:value-of select=&quot;@EstimatedAssetValue&quot;/>
Requested Information: <xsl:value-of select=&quot;@RequestedInformation&quot;/>
Comments: <xsl:value-of select=&quot;@Comments&quot;/>
</xsl:attribute>
<img src=&quot;/ImagesLib/btnEmail.gif&quot; />
</xsl:element>
</td>
</tr>

so each time I added another %0d, like after First Name and Last Name, less of the address would display in the mail message, and it would cut off at the address field.

Any ideas would be greatly appreciated!!
Ray
 
I would probably switch to using a server-side mail component such as CDONTS or ASPEmail, right now your email could be edited by someone when it pops up in their emailclient, and you have the problem of length, which may actually be a querystring problem...anyone know the limit on querystring length?

If you use a server side object you can simply send the email when they click the button/link and a)not worry about them changing information, b) not worry about the mailto link, and c) provide a cleaner interface

Jus some thoughts,
-Tarwn ________________________________________________________________________________
Want to get great answers to your Tek-Tips questions? Have a look at faq333-2924
 
Tarwn, thanks for the info.... I'll check into the querystring length issue. The reason I'm not using CDONTS is because we want to give the user the ability to edit the mail message; sometimes they need to add their own comments in the message in addition to the preformatted data.

Thanks again!
 
Add a textarea to the form to allow them to add comments and preview the email, they shouldn't be editing the preformatted data, so this adds another layer of protection.

-Tarwn ________________________________________________________________________________
Want to get great answers to your Tek-Tips questions? Have a look at faq333-2924
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top