Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Java mailto: URL, body= limitations?

Java mailto: URL, body= limitations?
Thread Tools
Mac Enthusiast
Join Date: Sep 2000
Location: Vermont, USA
Status: Offline
Reply With Quote
Jan 3, 2002, 11:46 AM
 
I am working on a Cocoa java app where I want the click of a button to take the text from an NSTextView and open the user's default email client and put the text into the body of the email message. I have been using Java's mailto: URL and using body=aString; where aString is the string form the NSTextView. This works fine with a small string, less than 600 characters about, but it doesn't work with over about 600 characters. I have a code for changing spaces and funky symbols into hex-decimal code. When the string is large I don't get any errors in PB.

Does anyone know if there is a size limit to the string length I can use?
     
Mac Elite
Join Date: Feb 2001
Location: Vancouver, WA
Status: Offline
Reply With Quote
Jan 4, 2002, 03:00 AM
 
Good luck. In or work on OmniCrashCatcher, we've found that there's no good reliable way to cause the user's mail client to open a compose window with a message body of any significant length. The InternetConfig/LaunchServices API for farming our mailto: URLs (which is the implementation for other APIs such as NSWorkspace and the JDK) has about a 1K limit on URL length. (Actually, according to the RFC for standard URLs, they aren't supposed to be able to get bigger.)

We used to use the private Mail.framework to send crash reports via Apple Mail, but that's gone in 10.1. Our next best approach has been to use AppleScript. By directly invoking an app's GetURL handler, we can circumvent the 1K limit of InternetConfig/LaunchServices. However, AppleScript has a length limit of 32K for string constants. So, we break up the report into several small chunks, concatenate them together using the & operator in AppleScript, and pass the whole thing as an argument to «event GURLGURL».

This works just fine for Apple Mail, but it seems other mail clients have problems with it. Eudora works fine, as does Netscape Communicator 4.x (in Classic), but just about every other mail client fails to get the complete body text, or any at all. Entourage works fine if the text is short, but if the text is beyond a certain length, it will crash. (And due to the nature of AppleEvents in OS X, it will relaunch and crash again several times.)
Rick Roe
icons.cx | weblog
     
Mac Enthusiast
Join Date: Sep 2000
Location: Vermont, USA
Status: Offline
Reply With Quote
Jan 4, 2002, 09:36 AM
 
Thanks Rickster. I have to say I am a novice at this and I don't really have any idea of how to make apple script do it, but at least now I know where to start. Thank you for your help.
     
Mac Elite
Join Date: Sep 2000
Location: in front of the keyboard
Status: Offline
Reply With Quote
Jan 4, 2002, 10:09 AM
 
Why not just use the javax.mail api?
I am sure there must be a way to query the preferences to see what the user's SMPT server is.
Then just send the message there directly.
signatures are a waste of bandwidth
especially ones with political tripe in them.
     
Mac Enthusiast
Join Date: Sep 2000
Location: Vermont, USA
Status: Offline
Reply With Quote
Jan 4, 2002, 10:38 AM
 
I thought about doing that, but I really like to keep all of my emails going and coming out of one client. And this way the user can see the email before it sent and edit it and mess around with it.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 01:28 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2