max length of mailto URL for viewer.exe

Having trouble running Advanced Installer? Got a bug to report? Post it all here.
shelmers
Posts: 51
Joined: Thu Sep 03, 2009 9:02 pm
Location: Andover, Massachusetts USA

max length of mailto URL for viewer.exe

Postby shelmers » Tue Oct 06, 2009 8:07 pm

I'm using viewer.exe to launch a URL, which happens to be a "mailto:" URL that pops open a new email message on the user's system. Works fine... except that there seems to be a limitation on the length of the URL that viewer.exe will accept. At approximately 580 characters the installation dies. A few characters less and the email pops up just fine. Naturally, I would like to create an message body that contains more characters than that.

The URL format I'm using is

Code: Select all

mailto:support@xyz.com?Subject=support request&Body=XXX

where XXX is the text of the email message.

Is there an upper limit on the parameter length that viewer.exe will accept? Given that it appears that there is, can anyone recommend an alternative way to launch a long mailto: URL?

Thanks

GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact:

Re: max length of mailto URL for viewer.exe

Postby GabrielBarbu » Wed Oct 07, 2009 8:51 am

Hello,

This limitation is caused by the msi database. you could try placing the contents of the Body in a property and use that. For example:

Code: Select all

mailto:support@xyz.com?Subject=support%20request&Body=[BODY]

You would set the BODY property from the Install Parameters page in Advanced Installer. Note that the subject and body need to be url-encoded. You can use this online tool for url encoding to achieve this.

Regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/

shelmers
Posts: 51
Joined: Thu Sep 03, 2009 9:02 pm
Location: Andover, Massachusetts USA

Re: max length of mailto URL for viewer.exe

Postby shelmers » Wed Oct 07, 2009 4:16 pm

Thanks for the suggestion, however, the number of characters in the command line box isn't the issue. My entire URL is actually a property that I create in a previous custom action. That is, I create MAILTO_URL in a VBscript in which I also do the percent encoding. I then use MAILTO_URL as the command line for viewer.exe.

The challenge is that if MAILTO_URL contains approximately 580 characters then the email gets created properly. If it contains more than that, then viewer.exe fails.

I suppose there are several possible points of failure:
1) the command line argument for viewer.exe is getting truncated
2) viewer.exe can't handle a parameter longer than ~580 characters
3) the mailto: URL doesn't support more than ~580 characters

I'm fairly certain that #3 isn't an issue because if I paste the entire 600+ character url into Internet Explorer, the correct email pops open as expected.

I've attached a debug version of the script that creates the URL. At the moment it just creates and displays the mailto URL. Create an installer with a property called MAILTO_URL, uncomment line 100 in the script, and create a custom action that calls viewer.exe with MAILTO_URL as the command line.
Attachments
Get Locking Code and Create mailto URL v4D.txt
debug version of script that creates long mailto: URL
(4.45 KiB) Downloaded 219 times

GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact:

Re: max length of mailto URL for viewer.exe

Postby GabrielBarbu » Thu Oct 08, 2009 12:24 pm

Hello,

This was a limitation in viewer.exe due to the fact that the viewer was mainly intended for file URLs, not data exchange. We now removed this limitation. The change will be available in the next version of Advanced Installer.
If you need the new version sooner than that, please contact us at support at advancedinstaller dot com and we will send you the new version of viewer.exe.

Regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/

shelmers
Posts: 51
Joined: Thu Sep 03, 2009 9:02 pm
Location: Andover, Massachusetts USA

Re: max length of mailto URL for viewer.exe

Postby shelmers » Thu Oct 08, 2009 3:29 pm

Thanks for the response and for providing an immediate fix for my problem. I love this product and it makes it even better that you guys are so responsive. thanks.

shelmers
Posts: 51
Joined: Thu Sep 03, 2009 9:02 pm
Location: Andover, Massachusetts USA

Re: max length of mailto URL for viewer.exe

Postby shelmers » Mon Oct 12, 2009 2:29 am

The modified viewer.exe worked great, so I added the rest of the text I need in the email I'm generating with the mailto: URL. Unfortunately, viewer.exe now fails at a higher limit -- it works with 635 characters but fails with 645. What is the current upper limit? Is it possible to have viewer.exe accept approx. 1000 characters? Creating this email is crucial to the success of my installer.

Thanks,
Scott

GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact:

Re: max length of mailto URL for viewer.exe

Postby GabrielBarbu » Mon Oct 12, 2009 2:42 pm

Hi Scott,

We have sent an improved version of viewer.exe that does not have any limitations. However the viewer.exe is using the ShellExecuteEx API (which is needed to launch mailto URLs) which has a limit of 2048 characters for the command line length as stated on this MSDN Blog.

To overcome this limitation, you can follow these steps:
- on the Search page, create a new search with the name MAIL_CLIENT
- add a new Location for the search
- set the parameters for the Location to the following:

Code: Select all

Root: HKEY_CLASSES_ROOT
Key: mailto\shell\open\command
Name: [~]
Type: Retrieve the raw value

Note: the above search will effectively set the MAIL_CLIENT property to the path of the machine's default email client. Its value will look something like:

Code: Select all

"C:\Program Files\Mozilla Thunderbird\thunderbird.exe" -osint -compose "%1"

- on the Custom Actions page, add a script that will compose the message (the script that you posted above will work just fine). The script will also need to replace the "%1" part in MAIL_CLIENT with your message, and store the result in a new property, say MAILTO_COMMAND. This property should end up being set to something like:

Code: Select all

"C:\Program Files\Mozilla Thunderbird\thunderbird.exe" -osint -compose "mailto:support@TaskMap.com?Subject=TaskMap%20Locking%20Code&Body=Test%20message"

- schedule an "EXE with Working Dir" custom action after the previous VBScript custom action. Set the Full Path field to: [MAILTO_COMMAND]

Note: make sure you properly condition the two custom actions to only be executed if there is an email client present on the machine. The following condition:

Code: Select all

(Not Installed) AND (MAIL_CLIENT <> "")
should work just fine.

Attached is a sample project that implements this.

Regards,
Gabriel
Attachments
sample.zip
(4.29 KiB) Downloaded 223 times
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/

shelmers
Posts: 51
Joined: Thu Sep 03, 2009 9:02 pm
Location: Andover, Massachusetts USA

Re: max length of mailto URL for viewer.exe

Postby shelmers » Mon Oct 12, 2009 3:28 pm

For my needs, < 2048 characters is quite sufficient, but thanks for the details on expanding beyond that limit.

Scott


Return to “Common Problems”

Who is online

Users browsing this forum: No registered users and 2 guests