This blog post walks you through the process I took to troubleshoot and solve the error “An error occurred while sending mail” while utilizing Adobe Reader’s send by email feature. Click here to jump to the final solution.
Adobe Reader has a feature which allows you to send PDF files as attachments through Outlook. Most of the time this works flawlessly, however, I recently ran into this issue while working on an end user’s PC. When attempting to use Adobe Reader’s send file by email feature, they would receive the following error message.
After receiving the error message I verified that Adobe Reader and Outlook were updated to the latest versions and that Outlook was set as the default email client for the user account in Windows 10. But still, the error continued.
Typically, a quick Google search leads to the solution. However, the top search results had multiple users reporting that none of the recommended solutions fixed their issue.
Would the end-user just have to live without this feature? I decided to take a closer look using one of the Windows Sysinternal tools, Process Monitor. My experience with this tool is limited, but I figured this was an opportunity to expand my knowledge.
Process Monitor: Adobe Reader Process Activity
Process Monitor allows you to monitor file system, registry and process activity. You can download the tool directly from Microsoft at https://docs.microsoft.com/en-us/sysinternals/downloads/procmon
I recommend launching the tool using the command prompt by entering the command below. Otherwise, when you launch the executable, the application begins capturing activity immediately.
> Procmon.exe /noconnect
You can start capturing process activity by clicking on the Capture icon, or by pressing CTRL + E. After the capture is started, I switched to Adobe Reader to recreate the error message by selecting Send file by email, disabling attach as a link, then clicking Next.
Once the error message popped up, I stopped Process Monitor from capturing any more events. Even though this process took a matter of seconds, you can see that the activity log captured over 300k operations. Luckily, we can filter these logs to only include events from the Adobe Reader application, AcroRd32.exe or Acrobat.exe for 64bit.
After filtering the logs to only include events from the AcroRd32.exe, I was able to locate the following event where Adobe Reader queries the Registry for the application path to Outlook but the value was empty.
To verify, I queried the registry using the following commands on both the problem PC and a working PC. Alternatively, you can open RegEdit.exe and navigate through the file structure.
# Working PC C:\WINDOWS\system32>reg query "HKLM\Software\Microsoft\Windows\CurrentVersion\App Paths\outlook.exe" HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\App Paths\outlook.exe (Default) REG_SZ C:\Program Files\Microsoft Office\Root\Office16\OUTLOOK.EXE Path REG_SZ C:\Program Files\Microsoft Office\Root\Office16\ # Problematic PC C:\WINDOWS\system32>reg query "HKLM\Software\Microsoft\Windows\CurrentVersion\App Paths\outlook.exe" HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\App Paths\outlook.exe (Default) REG_SZ
At this point, I believe I’ve found our problem. Adobe Reader is unable to determine the path to our Outlook executable, so the application errors out. On the problematic PC, it’s time to locate the location of the Outlook application and update the registry key.
Solution: Update the Windows Registry
Before updating the registry, we need to identify the path to the Outlook application.
- In the Windows search box, type Outlook, then select Open File Location. This should open a File Explorer window at C:\ProgramData\Microsoft\Windows\Start Menu\Programs.
- Locate and right click the Outlook shortcut, then click Properties.
- In the Target field, you will have the path to the Outlook executable. In my case this was C:\Program Files\Microsoft Office\root\Office16\OUTLOOK.EXE
The registry can be updated using one of the three options below. The first one is a graphical interface which may be easier for non-technical users. PowerShell and the CMD line are useful if you’re making these changes from a remote machine in a corporate environment. In addition, it’s typically recommended that you backup the registry before making changes.
Update Registry with RegEdit
RegEdit provides an easy-to-use graphical user interface for viewing and modifying the Windows registry. Follow the outline below to update your entries using the application path we identified in the steps above.
- Open Registry Editor.
- Navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\outlook.exe
- Add or edit the string values to include the following
Name | Type | Value |
(Default) | REG_SZ | C:\Program Files\Microsoft Office\Root\Office16\outlook.exe |
Path | REG_SZ | C:\Program Files\Microsoft Office\Root\Office16\ |
Update Registry with Command Line
Updating the registry keys with command prompt is easy. Open an elevated command prompt window and use the commands below. Make sure to update the file path to the version of Outlook which is installed on your system.
REG ADD "HKLM\\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\outlook.exe" /ve /t REG_SZ /d "C:\Program Files\Microsoft Office\Root\Office16\outlook.exe" /f REG ADD "HKLM\\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\outlook.exe" /v Path /t REG_SZ /d "C:\Program Files\Microsoft Office\Root\Office16\"
Update Registry with PowerShell
The registry keys can be updated using PowerShell as well. Below is a script which updates or adds the missing keys.
- Edit line 2 and insert the path to your copy of Outlook.
- Run the script from an elevated PowerShell window.
# Edit this Outlook path to match the path located in the previous step $outlookPath = "C:\Program Files\Microsoft Office\Root\Office16\" # Registry application path $registryPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\outlook.exe" # Test Outlook path to confirm it exists if(!(Test-Path -Path "$outlookPath\outlook.exe")){ Write-Host "[Error] Path does not exist, $($outlookPath)OUTLOOK.EXE" -BackgroundColor Red } else { Write-Host "[Information] Path found, $($outlookPath)OUTLOOK.EXE" -BackgroundColor DarkGreen # Test if registry path exists if(!(Test-Path $registryPath)){ Write-Host "[Warning] Registry key does not exist, $registryPath" -BackgroundColor DarkGray # Create new registry key and values Write-Host "[Information] Creating registry key" -BackgroundColor DarkGreen New-Item -Path $registryPath -Value "$($outlookPath)OUTLOOK.EXE" New-ItemProperty -Path $registryPath -Name "Path" -Value $outlookPath -PropertyType String } else { # Update existing registry keys and values Write-Host "[Information] Adding registry properties" -BackgroundColor DarkGreen New-ItemProperty -Path $registryPath -Name "(default)" -Value "$($outlookPath)OUTLOOK.EXE" -PropertyType String if([bool](Get-ItemProperty $registryPath).Path){ Write-Host "[Information] Path already exists, updating value" -BackgroundColor DarkGreen Set-ItemProperty -Path $registryPath -Name "Path" -Value $outlookPath -Type String } else { New-ItemProperty -Path $registryPath -Name "Path" -Value $outlookPath -PropertyType String } } }
Final Thoughts
Did this solution work for you or are you still experiencing issues with Adobe Reader? Let me know in the comments section!
Thank you so much! Saved my butt
Spot on Matt!
Thank you very much.