473,396 Members | 1,773 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

using mailto: body limit

I'm using the following code to fill an email for the user to send:

var t = escape(t); // to
var s = escape(s); // subject
var b = escape(b); // body

var doc = "mailto:" + t + "?subject=" + s +"&body=" + b;
window.location = doc;

If works fine until the length of 'b' gets over about 255 character,
then I get an "invalid syntax" error at the last line. Is there a limit
on the size of the body text for an email in this case?

Andrew Poulos
Feb 29 '08 #1
2 13544
Andrew Poulos wrote:
var t = escape(t); // to
var s = escape(s); // subject
var b = escape(b); // body

var doc = "mailto:" + t + "?subject=" + s +"&body=" + b;
window.location = doc;

If works fine until the length of 'b' gets over about 255 character,
then I get an "invalid syntax" error at the last line. Is there a
limit on the size of the body text for an email in this case?
I think it's not the size of your 'b'-variable that matters, but the
size of the total URI; in your case, the 'doc'-variable. As per my
test on Vista MSIE 7.0.6. and FireFox 2.0.0.12., I don't see any
problems here as long as the full URI remains below 2K. Probably this
is enforced by the email client (in my case Windows Mail 6.0.6.) and
not by the browser.

Allowed URI size in Windows:
http://support.microsoft.com/kb/208427

On the other hand, http://www.ietf.org/rfc/rfc2068.txt advises maximum
backwards compatibility, quote:

| Servers should be cautious about depending on URI lengths above
| 255 bytes, because some older client or proxy implementations
| may not properly support these lengths.

Maybe some email clients could block after a certain URI-length too. I
wouldn't rely on mailto-protocols over 255 under production conditions
anyhow.

Hope this helps,

--
Bart
Feb 29 '08 #2
Bart Van der Donck wrote:
>If works fine until the length of 'b' gets over about 255 character,
then I get an "invalid syntax" error at the last line. Is there a
limit on the size of the body text for an email in this case?
I think it's not the size of your 'b'-variable that matters, but the
size of the total URI; in your case, the 'doc'-variable. As per my
test on Vista MSIE 7.0.6. and FireFox 2.0.0.12., I don't see any
problems here as long as the full URI remains below 2K. Probably this
is enforced by the email client (in my case Windows Mail 6.0.6.) and
not by the browser.
Allowed URI size in Windows:
http://support.microsoft.com/kb/208427
The escape will significantly increase the size too. In this case I'd
add an alert with the length of the string just before trying to use it.
Feb 29 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Peter Bassett | last post by:
I thought this would be an easier task than it has become. I have a form for the user to enter resume information. There are several fields. I need to email this information to the Recruiter....
4
by: tp | last post by:
HI... I have created simple .asp page and i would like to send my page as email using my outlook . is it possible to send form body as new email outlook body using mailto command or any other...
2
by: Nigi | last post by:
I've made a mysql database with php front end which, in part, contains mailing lists. I've used a mailto: link to create a new email with their names in the bcc: field. Unfortunatley their is a...
3
by: Yogi_Bear_79 | last post by:
I am building a stand alone html help system (.chm.) So the usual woes with mailto are not going to be encountered. Likewise I am ensured all my intended users have Outlook installed. With that...
5
by: timjowers | last post by:
Hi, I'm attempting to send a mailto: and include a link in the body. Has anyone done this? Also, has anyone done mailto: with Lotus Notes 6.5? It will place the body in the subject line if it...
13
by: John Baker | last post by:
HI; Quick question: How do I specify an email subject when using the setup <a href="mailto:dogs@cats.com">Mail to the cat</a> Can someone show me how it would look if the subject was "mice"?...
11
by: Mohammed Abdel-Razzak | last post by:
dear sirs i want to send email using c# but i don`t want to use CDONTS or tell me how can i use it i don`t know any thing about CDONTS thanks
15
by: tshad | last post by:
I am trying to put an persons email address in a response I am sending another person. I can get it to work by doing the following: message.Body = resumeTop & vbCrLf & vbCrLf & "For Applicant:...
7
by: Paul Bromley | last post by:
I am using mailto to open the default e-mail program on the users machine using the following function code snippet that I found on th web.:- Public Function OpenEmail(ByVal EmailAddress As...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.