Some people like to have voicemail forwarded to email, but when they try to listen, the attachment won’t open. That’s because Outlook SecureTempFolder is full. Here’s how to automatically empty it upon closing Outlook.

In Outlook SecureTemp Files Folder and Red X’s in Email Messages I explain what the SecureTemp folder is and issues that result from a “full” SecureTemp folder. I also tell you how to find the folder and empty it manually.

While you can delete the contents of the SecureTempFolder manually, you may want to delete the folder each time you close Outlook.

Source: Clear SecureTempFolder automatically using VBA

TLDR: Here is the script that you add to ThisOutlookSession using the VBA script editor ([Alt]-[F11]):

Option Explicit

'If you prefer to run this manually whenever you feel like it, change Private Sub Application_Quit() to Public Sub EmptySecureTemp() and run it as needed.
Private Sub Application_Quit()
'=====================================================================
' Deletes the files of the SecureTempFolder (OLK) when closing Outlook
' (c) Peter Marchert - //www.outlook-stuff.com
' 2008-11-06 Version 1.0.0
'=====================================================================
Dim objFSO As Object
Dim objWsh As Object
Dim objFolder As Object
Dim strRegKey As String
Dim strOLK As String

On Error Resume Next
'---------------------------------------------------------------------
' To read data from the registry
'---------------------------------------------------------------------

Set objWsh = CreateObject("WScript.Shell")

'---------------------------------------------------------------------
' Set the registry key to read
'---------------------------------------------------------------------

strRegKey = "HKEY_CURRENT_USER\Software\Microsoft\Office\%.0\Outlook\Security\OutlookSecureTempFolder"

'---------------------------------------------------------------------
' Read SecureTempFolder from the registry
'---------------------------------------------------------------------

Select Case Left(Outlook.Version, 2)
Case "9.": strOLK = objWsh.RegRead(Replace(strRegKey, "%", "9"))
Case "10": strOLK = objWsh.RegRead(Replace(strRegKey, "%", "10"))
Case "11": strOLK = objWsh.RegRead(Replace(strRegKey, "%", "11"))
Case "12": strOLK = objWsh.RegRead(Replace(strRegKey, "%", "12"))
Case "14": strOLK = objWsh.RegRead(Replace(strRegKey, "%", "14"))
Case Else
MsgBox "Cannot determine your Outlook version.", vbCritical + _
vbOKOnly, "Delete OLK"
Exit Sub

End Select

'---------------------------------------------------------------------
' VBA does not provide comfortable functions to delete files, so we use
' VB-Script.
'---------------------------------------------------------------------

Set objFSO = CreateObject("Scripting.FileSystemObject")

'---------------------------------------------------------------------
' Delete all files in the SecureTempFolder (True = force deleting)
'---------------------------------------------------------------------

Call objFSO.DeleteFile(strOLK & "*.*", True)

'---------------------------------------------------------------------
' Reference the SecureTempFolder
'---------------------------------------------------------------------

Set objFolder = objFSO.GetFolder(strOLK)

'---------------------------------------------------------------------
' Open the folder if it is not empty
'---------------------------------------------------------------------

If objFolder.Files.Count Then Call Shell("explorer.exe " & strOLK)

'---------------------------------------------------------------------
' Clean Up
'---------------------------------------------------------------------

Set objFolder = Nothing
Set objFSO = Nothing
Set objWsh = Nothing
End Sub