Thursday 30 October 2008

"Send to Mail Recipient" in XP x64 with Thunderbird

I recently moved over to using Windows XP x64 edition, although I read in many places it can be a pain in many respects, I really needed to start using more than the 3GB or so of RAM 32-bit lets you use. Along the way I have found a lot of annoyances and things that just don't work as they should. Slowly I'm trying to find workarounds and other methods to use XP as I need to, and am used to, and I will post these on this blog to hopefully help other people.

One thing that I use a LOT is the "Send to" and then "Mail Recipient" to very quickly send files as an attachment via email. If you have never used this before - give it a go - it's very useful! If you are reading this though, chances are you already use it and want to use it in XP x64.

The problem is, that being 64 bit, x64 won't "play nicely" with 32 bit apps. If you use a 32 bit email client like Thunderbird then no matter what you do, this will not let you send files to be attached with Thunderbird. Instead it will use Outlook Express, which is a native 64 bit app. I spent a LONG time searching and found no workaround for this, so I made my own.


The Solution

It's fairly simple, it involves a .vbs (Windows Script) and a shortcut in the "SendTo" folder.

To try it yourself, repeat the following:

1) Create a new file called "catch_send_to.vbs", I placed this in c:\Program Files (x86)\Mozilla Thunderbird\

2) Open this file in notepad, and paste in the following code:

' Init variables
Dim i, files, cmd, attach

' Get reference to files passed by "Send to" method
Set files = WScript.Arguments

' Set up window object
Set WshShell = WScript.CreateObject("WScript.Shell")

' Set command to open Thunderbird
cmd = """C:\Program Files (x86)\Mozilla Thunderbird\thunderbird.exe"" "

' Form command to attach files - header
attach = "-remote ""xfeDoCommand(composeMessage,attachment='"

' Loop through arguments and add files to attach
i = 0

Do Until i = files.length

' Update the string
attach = attach & "file:///" & files(i)

' Insert a comma if needed
If i < files.length Then
attach = attach & ","
End if

' Increment i
i = i + 1

Loop

' Form command to attach files - footer
attach = attach & "')"""

' Run command to compose a new message and attach the files
WshShell.Run cmd & attach

3) Save your file with this code. Now go to your SendTo folder, this will be at c:\Documents and Settings\SendTo

4) In this folder, right click and click "New" and then "Shortcut". For the location paste in:

c:\Program Files (x86)\Mozilla Thunderbird\catch_send_to.vbs

Click "Next", call it something like "Thunderbird", and finally click "Finish"

This will add a new item to your Send To menu called Thunderbird, use it like you would use the "Mail Recipient" and it will do the same job!

Any comments/questions/feedback would be appreciated.

17 comments:

poppa_f said...
This comment has been removed by a blog administrator.
Anonymous said...

You saved me *much* frustration. I couldn't get the built-in Send To "Mail Recipient" to work on my 32-bit Vista system. Took out the " (x86)" references in the path, and it worked perfectly!!

Thank You!

Anonymous said...

Thanks, I've been using XP64 and Thunderbird since it first came out and I could swear there was a time when it did work.. but thanks just the same, it's been a thorn in my side.

jcsmsa said...

I found an easy solution- force XP x64 to open Explorer as 32-bit. It's very easy. Jump down to the Dec 22 post in my thread at mozillazine

http://forums.mozillazine.org/viewtopic.php?f=39&t=892425

Anonymous said...

I've introduced a small modification to also work on paths with spaces in them:



' Init variables
Dim i, files, cmd, attach,

' Get reference to files passed by "Send to" method
Set files = WScript.Arguments

' Set up window object
Set WshShell = WScript.CreateObject("WScript.Shell")

' Set command to open Thunderbird
cmd = """C:\Program Files (x86)\Mozilla Thunderbird\thunderbird.exe"" "


' Form command to attach files - header
attach = "-osint -compose attachment='"

' Loop through arguments and add files to attach
i = 0

Do Until i = files.length

' Update the string
attach = attach & """file:///" & files(i) & """"

' Insert a comma if needed
If i < files.length Then
attach = attach & ","
End if

' Increment i
i = i + 1

Loop

' Form command to attach files - footer
attach = attach & "'"


' Run command to compose a new message and attach the files
WshShell.Run cmd & attach

Danny Richardson said...

@Avshalon

I found the problem with using the -compose command was you can only attach one file, which isn't that useful - did you find a work around for this? Also the method I posted works fine with spaces in for me?

Danny Richardson said...

@BroccoliRob

Unfortunately that only works if you create a shortcut and then always use that, what if you go in via a folder shortcut, or the start menu, dockbar, mydocuments, other program etc. I think it could cause a lot of problems trying it that way.

jcsmsa said...

Yes, any of those would cause it to use OE instead. It takes getting used to opening Explorer only that way, but like anything else, you get used to it quickly.

Alok Jalali said...

hi, the sent to mail recipient for thunderbird widows xp 64 was working perfectly until i upgraded to thunderbird 3.xx (latest release)

We all need you to re-look at it to make it work again for the latest release.

Cheers and keep up the good work

Anonymous said...

My Win XP x64 don't wannna work with this solution:

' Init variables
Dim i, files, cmd, attach

' Get reference to files passed by "Send to" method
Set files = WScript.Arguments

' Set up window object
Set WshShell = WScript.CreateObject("WScript.Shell")

' Set command to open Thunderbird
cmd = """C:\Program Files (x86)\Mozilla Thunderbird\thunderbird.exe"" "

' Form command to attach files - header
attach = "-remote ""xfeDoCommand(composeMessage,attachment='"

' Loop through arguments and add files to attach
i = 0

Do Until i = files.length

' Update the string
attach = attach & "file:///" & files(i)

' Insert a comma if needed
If i < files.length Then
attach = attach & ","
End if

' Increment i
i = i + 1

Loop

' Form command to attach files - footer
attach = attach & "')"""

' Run command to compose a new message and attach the files
WshShell.Run cmd & attach

I remove upper comma in the end of this string

""xfeDoCommand(composeMessage,attachment='"

VOILA, now it's works perfectly. It's opening only write message window.

Anonymous said...

So the final version is :

' Init variables
Dim i, files, cmd, attach

' Get reference to files passed by "Send to" method
Set files = WScript.Arguments

' Set up window object
Set WshShell = WScript.CreateObject("WScript.Shell")

' Set command to open Thunderbird
cmd = """C:\Program Files (x86)\Shredder (64-bit)\thunderbird.exe"" "

' Form command to attach files - header
attach = "-remote ""xfeDoCommand(composeMessage,attachment="

' Loop through arguments and add files to attach
i = 0

Do Until i = files.length

' Update the string
attach = attach & "file:///" & files(i)

' Insert a comma if needed
If i < files.length Then
attach = attach & ","
End if

' Increment i
i = i + 1

Loop

' Form command to attach files - footer
attach = attach & "')"""

' Run command to compose a new message and attach the files
WshShell.Run cmd & attach


AND IT WORKS PERFECTLY!
Thanks to All participants.

Danny Richardson said...

Good stuff! I moved off xp64 to win7 64 and the support is 100x better in win7, but if you have to use xp still glad this is working well...

Anonymous said...

opps ...
Still does not work for me
upgraded to thunderbird version 3.0.4 some time back, and the code i still giving errors

Anonymous said...

sorry ... i think i didnt copy the code properly ... it is working fine now

Anonymous said...

To get this to work with multiple files :

' Init variables
Dim i, files, cmd, attach

' Get reference to files passed by "Send to" method
Set files = WScript.Arguments

' Set up window object
Set WshShell = WScript.CreateObject("WScript.Shell")

' Set command to open Thunderbird
cmd = """C:\Program Files (x86)\Mozilla Thunderbird\thunderbird.exe"" "

' Form command to attach files - header
attach = "-remote ""xfeDoCommand(composeMessage,attachment='"

' Loop through arguments and add files to attach
i = 0

Do Until i = files.length

' Update the string
attach = attach & "file:///" & files(i)

' Insert a comma if needed
If i < files.length Then
attach = attach & ","
End if

' Increment i
i = i + 1

Loop

' Form command to attach files - footer
attach = attach & "')"""

' Run command to compose a new message and attach the files
WshShell.Run cmd & attach

Benjamin Carl said...

Hi!

I had to change the following lines:

' Insert a comma if needed
If i < files.length Then
attach = attach & ","
End if

TO

' Insert a comma if needed
If i+1 < files.length Then
attach = attach & ","
End if

to prevent the trailing comma and get this script working (on XP x64 bit)

thanks a lot!!!

ben

Anonymous said...

Hello, thank you all for your work, just to say that this fix doesnt work for thunderbird 9.x, but it does work fot 3.x (i havent tried the ones betwen).

I downgraded and now im happy,

thanks again.