You are here

Thunderbird Portable as Default Mail Client (Integration)

8 posts / 0 new
Last post
Neddenien
Offline
Last seen: 3 years 5 days ago
Joined: 2020-04-10 11:04
Thunderbird Portable as Default Mail Client (Integration)

Here is the best and easy solution to make ThunderbirdPortable as Default Mail Client...

1. Create a subfolder in your ThunderbirdPortable folder (for example: "..\ThunderbirdPortable\Windows")

2. Change to the created subfolder to create the following batch-file...

3. Create a batch-file (for example: "Thunderbird Portable Integration.bat") with the following content :

@echo off
Title Thunderbird Portable Integration & Color 1E

cd /d %~dp0

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:USERLOGON
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

for /f "tokens=2 delims=\" %%a in ('wmic computersystem get username') do set "USERLOGON=%%a"
IF "%USERLOGON%" NEQ " " (set "USERLOGON=%USERNAME%") else (set "USERLOGON=%USERLOGON: =%")

NET SESSION >NUL 2>&1
IF NOT %ERRORLEVEL% == 0 (SET "RUNAS=USER") ELSE (SET "RUNAS=ADMINISTRATOR")

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:CHECK
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

set "CURRENT-PATH=%CD%" & cd..
set "PROGRAM-PATH=%CD%" & cd %CURRENT-PATH%

if exist "%PROGRAM-PATH%\ThunderbirdPortable.exe" goto :SETTINGS
if exist "%CURRENT-PATH%\ThunderbirdPortable.exe" set PROGRAM-PATH=%CURRENT-PATH% & goto :SETTINGS

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:SETTINGS
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

set "PROGRAM-LINK=%CURRENT-PATH%\Thunderbird Portable.lnk"
set "SENDTO-FILE=%CURRENT-PATH%\Thunderbird SendTo.cmd"
set "SENDTO-ICON=%PROGRAM-PATH%\app\appinfo\appicon.ico"
set "CONFIG-FILE=%CURRENT-PATH%\Thunderbird Portable.ini"
set "ROAMING-PATH=C:\Users\%USERLOGON%\AppData\Roaming"

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
: START
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

cls
echo ========================================================================================================================
echo THUNDERBIRD PORTABLE INTEGRATION (RUNNING AS: %RUNAS%)
echo ========================================================================================================================
echo.
echo PROGRAM-PATH : "%PROGRAM-PATH%"
echo CURRENT-PATH : "%CURRENT-PATH%"
echo PROGRAM-LINK : "%PROGRAM-LINK%"
echo SENDTO-FILE  : "%SENDTO-FILE%"
echo SENDTO-ICON  : "%SENDTO-ICON%"
echo CONFIG-FILE : "%CONFIG-FILE%"
echo ROAMING-PATH : "%ROAMING-PATH%"
echo.

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
: CHOICE
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

CHOICE /C YN /N /M "DO YOU WANT TO CONTINUE (Y/N): "

IF %ERRORLEVEL%==1 GOTO :PROCESSING
IF %ERRORLEVEL%==2 EXIT

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
: PROCESSING
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

if not exist "%PROGRAM-PATH%\ThunderbirdPortable.exe" goto :ERROR

cls
echo ========================================================================================================================
echo THUNDERBIRD PORTABLE INTEGRATION PROCESS (RUNNING AS: %RUNAS%)
echo ========================================================================================================================
echo.

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
echo CREATING CONFIG-FILE...
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

echo [General]>"%CONFIG-FILE%"
echo StartWithLastProfile=^1>>"%CONFIG-FILE%"
echo(>>"%CONFIG-FILE%"
echo [Profile0]>>"%CONFIG-FILE%"
echo Name=Portable>>"%CONFIG-FILE%"
echo IsRelative=^0>>"%CONFIG-FILE%"
echo Path=%PROGRAM-PATH%\Data\profile>>"%CONFIG-FILE%"
echo Default=^1>>"%CONFIG-FILE%"

echo.

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
echo CREATING SENDTO-FILE...
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

echo @echo off>"%SENDTO-FILE%"
echo if %%1. == . exit>>"%SENDTO-FILE%"
echo set PARAMS=file:///%%1>>"%SENDTO-FILE%"
echo :loop>>"%SENDTO-FILE%"
echo shift>>"%SENDTO-FILE%"
echo if %%1. == . goto send>>"%SENDTO-FILE%"
echo set PARAMS=%%PARAMS%%,file:///%%1>>"%SENDTO-FILE%"
echo goto loop>>"%SENDTO-FILE%"
echo :send>>"%SENDTO-FILE%"
echo start "Thunderbird" "%PROGRAM-PATH%\ThunderbirdPortable.exe" -compose attachment='%%PARAMS%%'>>"%SENDTO-FILE%"
echo.

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
echo CREATING PROGRAM-LINK...
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

set SCRIPT="%TEMP%\%RANDOM%-%RANDOM%-%RANDOM%-%RANDOM%.vbs"

echo Set oWS = WScript.CreateObject("WScript.Shell")>>%SCRIPT%
echo sLinkFile = "%PROGRAM-LINK%">>%SCRIPT%
echo Set oLink = oWS.CreateShortcut(sLinkFile)>>%SCRIPT%
echo oLink.TargetPath = "%SENDTO-FILE%">>%SCRIPT%
echo oLink.IconLocation = "%SENDTO-ICON%">>%SCRIPT%
echo oLink.Save>>%SCRIPT%

cscript /nologo %SCRIPT%
del %SCRIPT%
echo.

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
echo CLEANING OLD SENDTO-LINK...
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

del  /Q /F "%ROAMING-PATH%\Microsoft\Windows\SendTo\Thunderbird*.lnk"
echo.

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
echo COPYING CREATED FILES...
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

echo.
if not exist "%ROAMING-PATH%\Thunderbird" md "%ROAMING-PATH%\Thunderbird"
copy "%CONFIG-FILE%" "%ROAMING-PATH%\Thunderbird\profiles.ini"
copy "%PROGRAM-LINK%" "%ROAMING-PATH%\Microsoft\Windows\SendTo"

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:FINISH
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

echo.
echo ========================================================================================================================
echo FINISH - THE DEFAULT-MAIL-CLIENT MUST BE SET MANUALLY - FIRST IN THUNDERBIRD - THEN IN YOUR WINDOWS-DEFAULT-APPS !
echo ========================================================================================================================
echo.
pause
exit

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:ERROR
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

echo ========================================================================================================================
echo ERROR - MOVE THIS BATCH INTO YOUR THUNDERBIRD-PORTABLE FOLDER OR SUBFOLDER !
echo ========================================================================================================================
echo.
pause

4. Run created batch-file !

5. Default-Mail-Client must be set manually !

6. First in ThunderbirdPortable (Options/Settings)

7. Then in your Windows-Settings (Default-Apps)

8. Enjoy it !

Smile

Freebean
Freebean's picture
Offline
Last seen: 2 years 11 months ago
Joined: 2021-01-10 12:27
Works for my Win10

Finally, a fix that actually worked.
Had to put the bat file in THIS dir:
E:\ThunderbirdPortable\Other
& then run it from there.
tried a few other dir's & it wouldn't work from those.
.
So thanks for writing a good solution for all us portable people
we appreciate it. Smile
.

videobruce
Offline
Last seen: 8 months 3 weeks ago
Joined: 2014-05-09 17:39
didn't work in W7 Pro x64

Well I tried it in the default created folder and then in the main folder where the "thunderbird-portable.exe" file is and I keep on getting the Error page about the folder it's in.
TB is in E:\_Portables for C\Thunderbird v60 Portable

boardtc
boardtc's picture
Offline
Last seen: 2 years 6 months ago
Joined: 2022-02-12 06:41
I copied the batch to D:

I am running Windows 10 21H2 and copied the batch to D:\Applications\ThunderbirdPortable\Windows and ran. It output:
echo ERROR - MOVE THIS BATCH INTO YOUR THUNDERBIRD-PORTABLE FOLDER OR SUBFOLDER !
ERROR - MOVE THIS BATCH INTO YOUR THUNDERBIRD-PORTABLE FOLDER OR SUBFOLDER !

Running the script from the other folder gave the same error.

Does the script pick up D: \Applications for %PROGRAM-PATH%? I tried changing all occurrences of %PROGRAM-PATH% to that but I got the same error.

Any thoughts about how to get this cool script working for me?

Tim Chesnutt
Offline
Last seen: 11 months 5 days ago
Joined: 2006-08-03 14:38
Brilliant! Totally fantastic after all this time.

Thank you so much for posting this fix - I had missed the ability to have my Portable Thunderbird be my default email app.

I have this snippet of code saved as a bookmark in my Firefox Bookmark Toolbar, making it quick and simple to forward any page I am viewing - your fix makes it functional again:

javascript:location.href='mailto:?SUBJECT='+document.title+'&BODY='+escape(location.href)

PPlank
PPlank's picture
Offline
Last seen: 10 months 1 week ago
Joined: 2022-08-01 13:31
I just registered with PA

I just registered with PA (been using PA for a long time, never registered) just to thank you for this fix. I've put up with Win 10's nonsense for a long time and finally found your solution to setting portable ThunderBird as the the default email client. I'm using Win 10 21H1. I followed your instructions and it worked perfectly.

Now maybe someone can find a workaround for Edge intervening at every opportunity even though I have WaterFox set as the default browser. Edge Deflector worked great and then MS noticed it and now edge links have been locked down. Gah! Why do MS like to be the bad guy all the time? It's partly their nonsense towards us paying customers that's just made me build a Linux machine. Okay, it's a SteamDeck Holo build.
Wink

Thunderbird80
Offline
Last seen: 2 years 1 month ago
Joined: 2022-10-13 10:38
HP scan or Excel error when sending to default email client.

I tried this to get the HP scan and Excel applications working with Thunderbird portable without success. I have windows 10 x64 and Thunderbird x32 portable.

The problem seems to come from the "send to, mail recipient" context menu that is not working. HP scan is using that (mail API ?) to send scanned files to the mail client.

The error is : there is no default mail client. The mail client is defined as "Mozilla Thunderbird, Portable Edition" inside Windows settings. So i think it's ok here. Mailto links are working.

In the file explorer, the same error trig when i choose the context menu send to, mail recipient.

When Thunderbird is installed locally instead of portable, send to mail recipient is working, opening Thunderbird with the right attached files. HP scan and Excel are working too.

Edit : i was able to go deeper. My Thunderbird portable install was missing mozMapi32_InUse.dll file. After duplicating mozMapi32.dll and renamiing it to mozMapi32_InUse.dll i was able to start Thunderbird from the HP Scan or Excel application. But there was an error, no mail message neither attached file were created. Seems like a mail api error.

MiK
Offline
Last seen: 9 months 1 week ago
Joined: 2008-08-14 18:25
ThunderbirdPortable.ini

Do you use ThunderbirdPortable.ini in that copy of Thunderbird Portable?

If yes, and, if you have "AllowMultipleInstances" set to true, that would generally interfere with system integrations.

Also, the line "AdditionalParameters" with anything added to it could cause problems, too.

And, another possibility, you could cause the same, if launching that copy of Thunderbird Portable using command line with added arguments, especially the -no-remote one.

That's just a hint.

EDIT:
Forgot about Thunderbird versions, the above applies mainly to versions lower than 68. Since version 68, Thunderbird just ignores the -no-remote argument (AllowMultipleInstances=true in ini), at least when checking the Command line i the Task Manager.

Log in or register to post comments