Saving files to a desktop from Thunderbird

Hello everyone, I am currently using Thunderbird email client..and get an automated emailed sent to me everyday with a file in it..I was wondering if there was any way to save it to my PC everyday without me doing anything?
Who is Participating?

I have a quite different solution with a VBscript which works quite well.
Thunderbird naturally stores it's mail data in standard MBOX format, which can be handled as a simple text file.

1. Create a Mail folder inside Thunderbird where it will store the daily mails which attachments need to be extracted, call it for example Logfiles.

2. Create a Mail filter in Thunderbird which makes a copy of the desired mails to the newly created folder (you can filter by subject or what you like).

This way you have a separate folder which only contains the mails from which you want to extract the attachments.

3. Save this VBScript, and set up the first two constants to fit your system (the path to the newly created folder file, and the path for the wanted output directory)

4. Make a Scheduled job which daily calls it (for example 10-20-30 minutes after the mail arrives).



P.s. I've left the information about the author of the Base64 Decoder Function inside the code, just to be correct.

Option Explicit
Const MBOXFileLocation="C:\vbs\tstfolder\test_folder" ' Location of the file which contains the desired mails, for example "C:\Documents and Settings\User\Application Data\Thunderbird\Profiles\ib4qdqna.default\Mail\Local Folders\Logfiles" 
Const OutputFolder="C:\vbs\tstfolder\output" ' Path to the output directory, for example C:\Documents and Settings\User\Desktop\Daily Logfiles
Dim objFSO,objFile,objReadFile
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.GetFile(MBOXFileLocation)
Dim CurrentLine,CurrentFile,CurrentFileDataEncoded,CurrentFileDataDecoded
Dim Status  ' 0 - Nothing,  1 - Start of attachment found, searching for end,  2 - End marker found, processing BASE64 decode.
If objFile.Size > 0 Then
    Set objReadFile = objFSO.OpenTextFile(MBOXFileLocation, 1)
    Do Until objReadFile.AtEndOfStream
		If Status=1 Then
			' Add current line to CurrentLineData
			CurrentFileDataEncoded=CurrentFileDataEncoded & CurrentLine
		End If
		If InStr(1,CurrentLine,"Content-disposition: attachment;") > 0 Then 
			' Start of attachment found
		End If
		If (Status=1) and (CurrentLine="") and (CurrentFileDataEncoded<>"") and (InStr(1,CurrentLine,"Content-disposition: attachment;") = 0)Then
			' End of attachment found after a start
			WriteDecodedToFile OutputFolder & "\" & CurrentFile,CurrentFileDataDecoded
		End If
    'Nothing to do
End If
Sub WriteDecodedToFile(Target,SourceString)
	Dim objFSO, objWriteFile, nIndex
	Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objWriteFile = objFSO.OpenTextFile(Target, 2, True)
	For nIndex = 1 to Len(SourceString)
		objWriteFile.write Chr(Asc(Mid(SourceString,nIndex,1)))
End Sub
' Decodes a base-64 encoded string (BSTR type).
' 1999 - 2004 Antonin Foller,
' 1.01 - solves problem with Access And 'Compare Database' (InStr)
Function Base64Decode(base64String)
  '1999 Antonin Foller, Motobit Software,
  Const Base64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
  Dim dataLength, sOut, groupBegin
  'remove white spaces, If any
  base64String = Replace(base64String, vbCrLf, "")
  base64String = Replace(base64String, vbTab, "")
  base64String = Replace(base64String, " ", "")
  'The source must consists from groups with Len of 4 chars
  dataLength = Len(base64String)
  If dataLength Mod 4 <> 0 Then
    Err.Raise 1, "Base64Decode", "Bad Base64 string."
    Exit Function
  End If
  ' Now decode each group:
  For groupBegin = 1 To dataLength Step 4
    Dim numDataBytes, CharCounter, thisChar, thisData, nGroup, pOut
    ' Each data group encodes up To 3 actual bytes.
    numDataBytes = 3
    nGroup = 0
    For CharCounter = 0 To 3
      ' Convert each character into 6 bits of data, And add it To
      ' an integer For temporary storage.  If a character is a '=', there
      ' is one fewer data byte.  (There can only be a maximum of 2 '=' In
      ' the whole string.)
      thisChar = Mid(base64String, groupBegin + CharCounter, 1)
      If thisChar = "=" Then
        numDataBytes = numDataBytes - 1
        thisData = 0
        thisData = InStr(1, Base64, thisChar, vbBinaryCompare) - 1
      End If
      If thisData = -1 Then
        Err.Raise 2, "Base64Decode", "Bad character In Base64 string. Char: " & thisChar
        Exit Function
      End If
      nGroup = 64 * nGroup + thisData
    'Hex splits the long To 6 groups with 4 bits
    nGroup = Hex(nGroup)
    'Add leading zeros
    nGroup = String(6 - Len(nGroup), "0") & nGroup
    'Convert the 3 byte hex integer (6 chars) To 3 characters
    pOut = Chr(CByte("&H" & Mid(nGroup, 1, 2))) + _
      Chr(CByte("&H" & Mid(nGroup, 3, 2))) + _
      Chr(CByte("&H" & Mid(nGroup, 5, 2)))
    'add numDataBytes characters To out string
    sOut = sOut & Left(pOut, numDataBytes)
  Base64Decode = sOut
End Function

Open in new window

Hello dealstrike,

Thunderbird does not have a function or addin to auto save the file from email comming into itself.  You need to double click on the file to start the save process.  You can automate the save process by

Thunderbird will auto save a particular type of attachment.  In Tbird, go to Tools > Options > Attachment. Select "Save all attachment to this folder. Type in folder.  Click OK.
Double click on attachment.  Check to auto save this type of file..

Hope this helps!
dealstrikeAuthor Commented:
I there a way to do this via vb or vb script or something? Is it possible to automate saving of the email the file is in?
I do not know of a vb script to use.
dealstrikeAuthor Commented:
SWEET deal! Thanks, I will try this out in the next few days and let you know
Much obliged...I LOVE how vb has a solution to almost everything
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.